-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Magento_Catalog: Image attribute should have different parent class #8587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@koenner01 Why do you need Image to be successor of DefaultFrontend?
We don't have these neither in 2.0.* Actually for now Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend class doesn't have any successor. Currently the only place where Default Frontend class is used is in the AbstractAttribute class
and this behavior looks correct for me. Magento discourages usage of inheritance. So, a deep inheritance tree is a "smell" from architectural point of view. |
Yes, weird. I will check which version I was working on where the DateTime had a different parent class. The logic behind this was to expose the publics methods so they can have plugins injected, because you can't plugin an abstract class. We (and probably other people) are inserting custom logic into all EAV attributes and the most logic place to do this was in the DefaultFrontend. Should we set a preference instead on the abstract class ? |
Internal ticket to track issue progress: MAGETWO-64844 |
Hi @koenner01 |
Arrows Bugfix Delivery
Currently the 'Magento\Catalog\Model\Product\Attribute\Frontend\Image' model is inheriting from the abstract class 'Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend'.
The class should inherit from 'Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend' instead (which inherits from the abstract). This would be more consistent with other frontend attributes (like datetime) and more flexible in extending the functionalities of the frontend attributes.
Preconditions
Steps to reproduce
Expected result
Actual result
This fix would allow more flexibility when adding functionalities on the frontend attributes. You would not have to provide an extra preference to fix the 'incorrect' parent class for the image attributes.
An example of where this is already done in the core:
Magento\Eav\Model\Entity\Attribute\Frontend\Datetime
The text was updated successfully, but these errors were encountered: