Summary

In this chapter, we had a look at the object manager and dependency injection, which are the foundations of Magento object management. We learned the meaning of the type and preference elements of dependency injection and how to use them to manipulate class construct parameters. Though there is much more to be said about dependency injection in Magento, the presented information should suffice and help us with other aspects of Magento.

In the next chapter, we will extend our journey into di.xml via the concept of plugins.

Get Magento 2 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.