11
votes

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.

3
Id love to hear an answer for this too. The documentation for Magento is sorely lacking.Rick J
For anyone looking, I ended up partially solving this problem myself. alanstorm.com/category/magentoAlan Storm
Hi Alan, your resources have been invaluable. I have another question that I think you might know the answer too, and in addition would be a good resource for other novice magento devs such as myself. stackoverflow.com/questions/13356138/…Jason

3 Answers

3
votes

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

4
votes

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/

3
votes

For the Magento ORM which is based off of Zend Framework's Zend_Db_Adapter , you can use the Zend Framework Programmers Reference (Available as a free pdf on Zend Framework's site ). I also found this link helpful for learning more about Magento models.