O'Reilly logo

Magento 2 Development Cookbook by Bart Delvaux

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Magento collections

When you want to retrieve a set of entities of the same type, we usually use a query to get the data of a table.

But in Magento not every entity is stored in a single table and that means that a very complex query is required to get the data. A generic system/language to create queries for Magento entities was the solution.

For this solution, Magento has created a system called collections. A collection is a set of entities of the same type where you can add filters to it to customize your result.

In this recipe, we will see what we can do with Magento collections.

Getting ready

For this recipe, it is required to have the Packt_HelloWorld module installed with the code of the previous recipe Creating a flat table with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required