Video Lesson: Create a collection in Magento

Create a collection in Magento

This is premium content

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

Create a collection in Magento

Learn how to create a Magento collection class to retrieve multiple Post model records efficiently.

Lesson Content

We can now query, save & delete records with a resource model, but we can’t yet retrieve a list of records out of the database. This is when a collection comes into play.

Collections are actually considered an extension of the resource model, and will allow us to retrieve many records at once.

They are set up similarly to a model & resource model — very simple.

First, we’ll create our Collection class. The naming of this is a bit different from our model & resource model, which are named directly after the entities they relate to. Rather than also naming this Post, we will create...

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.