Video Lesson: Create a new object using Object Manager in Magento

Create a new object using Object Manager in Magento

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

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...

Premium content

Enroll to unlock the full content and all course materials.

Maggie

Hey, I'm Maggie! πŸ‘‹

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.