Magento Design Patterns

后端 未结 8 999
北海茫月
北海茫月 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:39

    Prototype:

    Mage:getModel('catalog/product')->getTypeInstance();
    

    Event-Observer Pair:

    # PHP
    Mage::dispatchEvent('event_name', array('key'=>$value));
    
    # config.xml
    
        
            
                
                    
                        
                            Class_Name
                            methodName
                        
                    
                
            
        
    
    

    Object Pool:

    $id = Mage::objects()->save($object);
    $object = Mage::objects($id);
    

    Iterator:

    Mage::getModel('catalog/product')->getCollection();
    

提交回复
热议问题