While I am aware of the similar question. My question is more generic, that what would happen to both calls whether I actually create a database column or not.


I know addColumn() will add a real table column, but when I'm diving into some core modules, some of them are calling both addColumn() and addAttribute() to the same field.

What is the difference between them?


Because addAttribute() looks very much EAV related to me, after some research I also find some similar names like addAttributeSet() and addAttributeSetNames().

How are they differ to each other?

  • Thanks for linking to the other question. Based on your edit, I'm inclined to mark this as a duplicate question given that Marius's answer to the linked question seems to answer your query as well. Will you please check?
    – benmarks
    Commented Dec 12, 2014 at 14:34
  • There is still one element that is not clear in my mind, I will add that into my question.
    – Vicary
    Commented Dec 13, 2014 at 2:26

1 Answer 1


Let's take it step by step.

  • addColumn adds a column to a table.
  • addAttribute adds a new attribute for EAV entities. So a new record will be created in the eav_attribute table.
  • The exception: For the sales module, addColumn and addAttribute do the same thing. They add a column to a table. The reason is backwards compatibility. Before version 1.4, the sales entities (orders, invoices, shipments, items, ...) were EAV so you had to use addAttribute. Starting with 1.4 the sales entities are flat so you have to use addColumn. But for backwards compatibility, starting version 1.4, addAttribute is just a wrapper for addColumn.
  • addAttributeSet is used for EAV entities and it does what it says. It creates a new attribute set for that entity. I think it is used for products only, because all the other EAV entities (category, customer, customer_address) use a single attribute set.
  • addAttributeSetNames - I didn't find any occurrence of this anywhere in the core code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.