eav_entity_type without quote at installation

匆匆过客 提交于 2019-12-07 10:33:08

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/10228992/eav-entity-type-without-quote-at-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!