Magento 2: ORM

Magento 2 works in many ways to the Magento 1 ORM structure.  They still have models, resource models, and collections.  There are a few small differences, but the overall structure remains unchanged.

Create a Module

Create the following folders:

  • app/code/Ecommage/OrmExample/etc/
  • app/code/Ecommage/OrmExample/Model/

Let’s register our module.

In app/code/Ecommage/OrmExample/etc/module.xml, enter the following:

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Ecommage_OrmExample" setup_version="1.0.0" />

In app/code/Ecommage/OrmExample/registration.php, enter the following:


There is no comment on this post. Be the first one.

Leave a comment