Skip to content

Magento 2: ObjectManager directly use?

You should not use the ObjectManager directly!

Exception from the rule are:

  • in static magic methods like __wakeupserialize, etc
  • in case you should make backward compatibility of constructor
  • in global scope, like in fixtures of integration test.
  • in class that needs only for creation of object like factory, proxy , etc
Share via
Copy link
Powered by Social Snap