the origin...
I have a module with a setup script (common mysql4-upgrade-0.1.0-0.1.1.php), adding an attribute to quote:
$eav = new Mage_Eav_Model_Entity_Setup('sales_setup');
$eav->addAttribute('quote', 'my_attribute', array('type' => 'varchar'));
If I run my magento store on an empty DB, setups scripts run and a 'Wrong entity ID' error breaks the process. Call stack points to my setup script.
...looking for...
If I go to database, I see eav_entity_type table filled but only with 8 types: the quote type is not registered!
That's why Mage_Eav_Model_Entity_Setup->getEntityTypeId() throws the exception.
The question:
I don't know why quote entity is not created with another entities. How can I force magento to register quote entity before my module setup? Is there any alternative?
There is a possibly related question
Starring from 1.4.x all the entities were moved in to flat structure. However it is still possible to use pseudo EAV interface of Mage_Sales_Model_Mysql4_Setup class. Your code is not working because you are using Eav setup model instead of Sales one.
Also, by default all the module setup scripts in app/code/local/ are processed only after scripts in app/code/core, so you can choose to not specify dependency on core module.
Sincerely, Ivan