问题
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.
回答1:
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
回答2:
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:
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.
来源:https://stackoverflow.com/questions/773562/magento-orm-documentation