2

When I have a PHP model or collection of a Magento entity (such as a product or customer), what PHP class(es) is in charge of constructing and executing the SQL that selects that model or collection of models from the database?

4

In most circumstances, entity models inherit from AbstractModel, resource models, which serves as an adapter between an entity model and ORM, inherit from AbstractDb, and collections inherit from AbstractCollection.

Take a look at the following classes:

  • Magento\Framework\Model\AbstractModel
  • Magento\Framework\Model\ResourceModel\Db\AbstractDb
  • Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
  • Magento\Framework\DB\Select

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.