I have read many blogs to understand some of the topics in Magento 2 but still not clear about them.
They are as follows
- Dependency Injection
Could anyone please explain them shortly?
Thanks in advance.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
I take this in my understanding,
First of all and EAV - Entity Attribute Value
According to magento, you would assume like below image
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.
Hope this information helps.