Create a new object using Object Manager in Magento
Learn how to create Magento objects with Object Manager and access customer session data programmatically.
Lesson Content
Rather than using the new keyword to create objects in Magento, the Object Manager class can be used. Object Manager is the dependency injection container class, and it will create objects that are instances of whatever class we pass to it.
This lesson is for informational purposes only. You never really want to ever use the ObjectManager class directly like we are about to do. Doing so circumvents how objects are to be created with dependency injection, and is known as a very bad practice in Magento land. That said, letβs demonstrate how we would go about creating objects like this any...
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.