cancel
Showing results for 
Search instead for 
Did you mean: 

\Magento\Catalog\Model\Product\ReservedAttributeList should not be a dependency for...

0 Kudos

\Magento\Catalog\Model\Product\ReservedAttributeList should not be a dependency for...

Feature request from tzyganu, posted on GitHub Jul 06, 2016

The class \Magento\Eav\Model\Entity\Attribute has as a dependency an instance of \Magento\Catalog\Model\Product\ReservedAttributeList.
This is wrong in my opinion.
Besides the fact that it introduces a circular dependency because EAV module now depends on the Catalog module and the Catalog module already depends on the EAV module.
But this circular dependency is not the main problem here (others might disagree).
The main problem is that the Catalog Product is not the only EAV entity in the application.
There are also Categories, Customers and Customer addresses.
This means that when I add an attribute for these entities Magento checks if there is a getter for that attribute name in the product model class.
This also restricts me when creating my own EAV entity to have attributes like price (and others).

I think the dependecy \Magento\Catalog\Model\Product\ReservedAttributeList should be replace with an interface ReservedAttributeListInterface that should reside in the EAV module with a single method isReservedAttribute and I can specify via di.xml the implementation used as dependency for each class that extends \Magento\Eav\Model\Entity\Attribute.