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.

1 Answer 1

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. Commented Jul 4, 2014 at 11:40
  • @Thorsten Thanks for naming the method, that is the one I meant. :) Commented Jul 4, 2014 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. Commented Jul 4, 2014 at 11:41

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.