I have read many blogs to understand some of the topics in Magento 2 but still not clear about them.

They are as follows

  1. EAV
  2. Dependency Injection

Could anyone please explain them shortly?

Thanks in advance.


I take this in my understanding,


First of all and EAV - Entity Attribute Value

According to magento, you would assume like below image

enter image description here

In real time you would assume like this entity and its attributes, values will be stored in separate table in an organised way. So this way of organising data is called EAV structure in Magento 2.

Dependency Injection :

Dependency Injection is a design pattern that allows an object A to declare its dependencies to an external object B that supplies those dependencies. The dependencies declared by A are usually class interfaces and the dependencies B provides are the concrete implementations for those interfaces.

You would simply assume as if you want to call a class A from B in the sense you should instantiate the class by injecting into constructor of class B and get all the necessary data and functions from class A.

Magento uses class constructor signatures to retrieve information about an object’s constructor dependencies. When a class is constructed, the object manager injects the class’s dependencies, defined in the di.xml file, into the class constructor.

For more information DI and EAV

Hope this information helps.

  • Thanks for the short and informative post! – Siva May 24 '19 at 11:29

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.