Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento ORM Documentation

Outside of the source code, is there any extensive documentation on the Magento ORM? I get the basics, and can usually dig through the Mage code base, litter it with Mage::Log calls and figure out something that works, but my efficiency would go way up if I had a high level overview of how the models are intended to be used. How do the aggregate methods work, what's the best way to join, when should you extend the models, when's the best time to use the eav models vs. the non-eav ones, etc.

Something like the Django Model Documentation, but for Magento.

like image 978
Alan Storm Avatar asked Apr 21 '09 16:04

Alan Storm


People also ask

What is ORM in Magento?

Object Relational Mapping (ORM) is a programming technique for converting between types of data and objects in OOP. There are 2 types of ORM: Convert different types of data to objects. Convert objects to various types of data.

What is the difference between model and resource model in Magento 2?

Models : Models are where your main business logic should be handled and is a single instance of an object. The model will use the resource model to talk to the database and get/set data for it on save() and load() . Resource Model : A resource model is where your main C.R.U.D happens (Create, Read, Update and delete).

What is Magento repository?

Repository Pattern separates the database logic and maps it to the objects in the business logic. It works with the domain entities and performs database logic. In the Repository pattern, the data objects, the database logic, and the business logic connect to each other using interfaces.


2 Answers

While there isn't much documentation on the ORM, here were a few pages that greatly helped in my understanding of the database structure which will help you understand everything else:

http://www.magentocommerce.com/wiki/development/magento_database_diagram http://www.magentocommerce.com/boards/viewthread/7359/

like image 149
James Skidmore Avatar answered Nov 11 '22 19:11

James Skidmore


Since this question was answered, some documentation has been created on the ORM at the magento knowledge base.

Introductory information: http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics

Advanced ORM usage and the EAV system: http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-7-advanced-orm-entity-attribute-value

Working with the Varien collections (lazy loading, filtering, etc...): http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-8-varien-data-collections

like image 32
Clayton Gulick Avatar answered Nov 11 '22 20:11

Clayton Gulick