3

I'm looking at a setup/install script which extends from Mage_Eav_Model_Entity_Setup and noticed that some of the attributes in the return array of the getDefaultEntities method have a 'visible' key (e.g. 'visible' => true) while others have an 'is_visible' key.

Is there a difference between the two? Is one just an unsupported typo that didn't get noticed and got copied and pasted too much?

None of the other Setup.php files in app/code/community or app/code/local use 'is_visible'.

I'm loath to change anything, but I'd like to understand what the differences might be.

2

The trick is the following:

When using ->addAttribute() the thing is called "visible", but when using updateAttribute(), it is "is_visible"

Update: They refer to the same thing, but the addAttribute() method (I think) defines a mapping, so the shorter version is used.

3
  • only when the setup resource is of type Mage_Catalog_Model_Resource_Setup. The mapping is defined there in the method _prepareValues. – Thorsten Jul 4 '14 at 11:40
  • @Thorsten Thanks for naming the method, that is the one I meant. :) – mpaepper Jul 4 '14 at 11:41
  • You are right. The addAttribute in the both Mage_Customer_Model_Resource_Setup and Mage_Catalog_Model_Resource_Setup transform visible to is_visible. Anyway, the base class Mage_Eav_Model_Entity_Setup should not be used. Only one of the 2 mentioned above because you can add attributes either to a catalog entity (category, product) or a customer entity (customer, address). If it's a custom entity it should have it's own setup model. – Marius Jul 4 '14 at 11:41

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.