Model vs ResourceModel vs Collection in Magento
Learn Magento Model vs ResourceModel vs Collection for entity data, database CRUD and querying multiple records.
Lesson Content
Magentoβs data layer is extremely complex, so itβs a good time to try to simplify the responsibility of each of these layers.
The data layer starts with models. A model is simple PHP class that represents a data entity. This can be something like a blog post, an email, a product, or something else entirely. So, I may have a Post model to represent a specific blog post. Models can be linked to a database, which is a type of resource. Models do not necessarily need to be connected to a database, but when they are, that's where ResourceModels come into play.
![](https://codex-assets.nyc3.cd...
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.