Magento Forum

rewrite for Mage_Eav_Model_Entity_Setup
 
ISA-Hamburg
Jr. Member
 
Total Posts:  22
Joined:  2010-02-18
 

Hello,

I want to rewrite the Mage_Eav_Model_Entity_Setup.
Tryed a lot, but it didn’t work :(

This is my confog.xml:

<?xml version="1.0"?>
<config>
    <
modules>
        <
XXX_YYY>
            <
version>1.0.0</version>
        </
XXX_YYY>
    </
modules>
    <global>
        <
models>
            <
xxxyyy>
                <class>
XXX_YYY_Model</class>
            </
xxxyyy>
            <
eav_setup>
                <
rewrite>
                    <
setup>XXX_YYY_Model_Entity_Setup</setup>
                </
rewrite>
            </
eav_setup>
        </
models>
    </global>
</
config>

Whats wrong with it?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Denys Babenko
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2010-03-03
Fritz-Elsas-Str. 60
 

I guess it should be changed from

<eav_setup>
    <
rewrite>
        <
setup>XXX_YYY_Model_Entity_Setup</setup>
    </
rewrite>
</
eav_setup>

to

<eav>
    <
rewrite>
        <
entity_setup>XXX_YYY_Model_Entity_Setup</entity_setup>
    </
rewrite>
</
eav>
 
Magento Community Magento Community
Magento Community
Magento Community
 
ISA-Hamburg
Jr. Member
 
Total Posts:  22
Joined:  2010-02-18
 

hm, doesn’t work for me :(
the class was not loaded…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Denys Babenko
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2010-03-03
Fritz-Elsas-Str. 60
 

try this… [UPDATED]

<eav_entity>
    <
rewrite>
        <
setup>XXX_YYY_Model_Entity_Setup</setup>
    </
rewrite>
</
eav_entity>

if works neither, read this
http://www.magentocommerce.com/boards/viewthread/14103/

 
Magento Community Magento Community
Magento Community
Magento Community
 
ISA-Hamburg
Jr. Member
 
Total Posts:  22
Joined:  2010-02-18
 

did all not help :(
can anyone try it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ISA-Hamburg
Jr. Member
 
Total Posts:  22
Joined:  2010-02-18
 

Is it possible, that some classes could not be overwritten?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
brobie
Sr. Member
 
Avatar
Total Posts:  139
Joined:  2008-07-28
 

Can you give the context that you are trying to rewrite this?  Rewriting will only work if you are directly doing a Mage::getModel(\’eav/entity_setup\’);

If you are using a class that extends Mage_Eav_Model_Entity_Setup and hoping that the child class will instead extend your new class, that is impossible.

The following IS the correct way to rewrite if you are doing Mage::getModel(\’eav/entity_setup\’);

<eav>
    <
rewrite>
        <
entity_setup>XXX_YYY_Model_Entity_Setup</entity_setup>
    </
rewrite>
</
eav>
 
Magento Community Magento Community
Magento Community
Magento Community
 
ISA-Hamburg
Jr. Member
 
Total Posts:  22
Joined:  2010-02-18
 

What do you mean with ”if you are doing Mage::getModel(\’eav/entity_setup\’);”?
All I want to do, is to overwrite the addAttributeOption() Function in the Mage_Eav_Model_Entity_Setup class. I need to get the insertID of the created option…

//EDIT: Solved the problem without rewrite! Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sanji123
Jr. Member
 
Total Posts:  2
Joined:  2012-07-17
 

It works for me

<models>
<eav>
<rewrite>
<entity_type>Company_OrderNumber_Model_Type</entity_type>
</rewrite>
</eav>
</models>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top