Magento Design Patterns

后端 未结 8 1006
北海茫月
北海茫月 2021-01-29 22:59

Magento, IMHO, represents a PHP system that is built on well thought-out coding principles - reuseable design patterns being one of them. In terms of an example of a PHP system

相关标签:
8条回答
  • 2021-01-29 23:47

    Don't forget about Lazy Loading, which means that database access only occurs when strictly necessary. For example:

    $collection_of_products = Mage::getModel('catalog/product')
    ->getCollection();
    $collection_of_products->addFieldToFilter('sku','n2610');
    

    The database query will not be made until you attempt to access an item in the Collection.

    0 讨论(0)
  • 2021-01-29 23:51

    I think that the relationship between Mage_Checkout_Model_Cart and Mage_Sales_Model_Quote is a Bridge design pattern. As defined by wikipedia Bridge is meant to "decouple an abstraction from its implementation so that the two can vary independently". Thus, Cart seems to be the abstraction and Quote seems to be the implementation.

    0 讨论(0)
提交回复
热议问题