A new dependency injection framework will be used for the code. By avoiding ObjectManager in Magento 2, you won’t face multiple issues caused by the improvement. source:https://firebearstudio.com/blog/magento-2-objectmanager-use-cases.html

If Magento injects the new dependency, why it is not affecting any child class which we have extended during development?

Any explanation would be appreciated.

Thanks in advance..!

1 Answer 1


Check this:

  • vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:143
  • vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:22

A simple answer that because creating a new object, factory check only arguments for requested type and resolve arguments of requested type but not there parent. Sometimes you can face an issue when, for example, you have extended ListProduct for custom listing and you have to change one of ListProduct's argument type for it and all children. So you can only create a preference for argument's type that you what to change or write in di you a custom argument for each child to apply it.

Hope I answered your question. Feel free to ask clarifying questions if it isn't clear for you :)

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.