4

If you drop all the tables in your Magento database, and navigate to your Magento site, what happens next?

The reason I ask is I assume that Magento would just check the local.xml settings, and rebuild the database with default/blank values.

The problem is I have an extension that uses the Composer autoloader for some of it's classes and therefore doesn't follow the Magento class naming convention. There are observers for that extension that bootstrap the composer autoloader but it seems like those observers aren't ran in the scenario of a Magento site having no tables yet.

Hope that makes sense, any help would be appreciated.

3

Well, I managed to work it out. I knew it was an autoloader issue, I just couldn't find the right event to observe.

I found this composer autoloader question that mentions the resource_get_tablename event. As a bonus I didn't even have to write my own observer since there's the Magento PSR-0 Autoloader extension that does just the trick!

I simply installed the extension, added my <composer_vendor_path/> to the <global> scope of my local.xml file and all was well in the world.

1

It will return the following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table '[db].core_url_rewrite' doesn't exist
  • 3
    delete the cache and it will actually rebuilt the database – Kristof at Fooman Mar 7 '14 at 3:33
  • Cray Cray. Plus one @fooman, and I forgot that caches are enabled in default install haha – philwinkle Mar 7 '14 at 4:13
  • I appreciate the answers, and as @Fooman stated, the database does indeed get rebuilt. But during this process one of my extensions, as explained above, is using the wrong autoloader. I suppose my question would be, is there an event when the database is being rebuilt from blank? – EasyCo Mar 9 '14 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.