Skip to main content
re-write and added few more
Source Link
Wasim
  • 455
  • 4
  • 18

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager. Also, direct use of its create() function prevents type validation and type hinting that a factory class provides.

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager. Also, direct use of its create() function prevents type validation and type hinting that a factory class provides.

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration", but you will not get the information of direct usage of ObjectManager. Also, direct use of its create() function prevents type validation and type hinting that a factory class provides.

re-write and added few more
Source Link
Wasim
  • 455
  • 4
  • 18

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager. Also, direct use of its create() function prevents type validation and type hinting that a factory class provides.

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager.

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager. Also, direct use of its create() function prevents type validation and type hinting that a factory class provides.

Source Link
Wasim
  • 455
  • 4
  • 18

You should not call the object manager directly because the framework handles this automatically. You can see few exceptions that Magento 2 core classes call the ObjectManager directly because this code needs exist for backward compatibility purposes. But, they are not approval of using the ObjectManager directly.

Moreover, if you run:

bin/magento dev:di:info "Magento\Quote\Model\QuoteRepository"

you will get "information on Dependency Injection configuration" what are written in di.xml, but you will not get the information of direct usage of ObjectManager.