当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Event::setName方法代码示例

本文整理汇总了PHP中Varien_Event::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event::setName方法的具体用法?PHP Varien_Event::setName怎么用?PHP Varien_Event::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Event的用法示例。


在下文中一共展示了Varien_Event::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dispatchEvent

 /**
  * @see Mage_Core_Model_App::dispatchEvent($eventName, $args)
  */
 public function dispatchEvent($eventName, $args)
 {
     $event = new Varien_Event($args);
     $event->setName($eventName);
     $observer = new Varien_Event_Observer();
     $observer->setData(array('event' => $event));
     $observer->addData($args);
     $this->_bar->update($observer->getEvent());
     return parent::dispatchEvent($eventName, $args);
 }
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:13,代码来源:App.php

示例2: dispatchEvent

 /**
  * @param $model string model syntax or class name (codex_module/observer or Codex_Module_Model_Observer)
  * @param $method string the exact method name (as defined in confix.xml)
  * @param $eventName string the original name of the event
  * @param array $args array
  */
 public static function dispatchEvent($model, $method, $eventName, array $args = array())
 {
     $event = new Varien_Event($args);
     $event->setName($eventName);
     $observer = new Varien_Event_Observer();
     $observer->setData(array('event' => $event));
     $observer->addData($args);
     $object = Mage::getModel($model);
     if (method_exists($object, $method)) {
         $object->{$method}($observer);
     }
 }
开发者ID:nhp,项目名称:Xtest,代码行数:18,代码来源:Xtest.php

示例3: testDispatchEventDoesNotCallApiIfNoMessages

 public function testDispatchEventDoesNotCallApiIfNoMessages()
 {
     $e = new Varien_Event();
     $e->setName('triggerCode');
     $observer = new Varien_Event_Observer();
     $observer->setEvent($e);
     $events = $this->getEventCollection();
     $this->observer->expects($this->once())->method('getEvents')->with('event', 'triggerCode')->will($this->returnValue($events));
     $messages = array();
     $this->messageProcessor->expects($this->once())->method('processEvents')->with($events, $observer)->will($this->returnValue($messages));
     $this->esendexApi->expects($this->never())->method('sendMultipleMessages');
     $this->observer->dispatchEvent($observer);
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:13,代码来源:ObserverTest.php

示例4: dispatchEvent

 public function dispatchEvent($eventName, $args)
 {
     $eventName = strtolower($eventName);
     foreach ($this->_events as $area => $events) {
         if (!isset($events[$eventName])) {
             $eventConfig = $this->getConfig()->getEventConfig($area, $eventName);
             if (!$eventConfig) {
                 $this->_events[$area][$eventName] = false;
                 continue;
             }
             $observers = array();
             foreach ($eventConfig->observers->children() as $obsName => $obsConfig) {
                 $observers[$obsName] = array('type' => (string) $obsConfig->type, 'model' => $obsConfig->class ? (string) $obsConfig->class : $obsConfig->getClassName(), 'method' => (string) $obsConfig->method, 'args' => (array) $obsConfig->args);
             }
             $events[$eventName]['observers'] = $observers;
             $this->_events[$area][$eventName]['observers'] = $observers;
         }
         if (false === $events[$eventName]) {
             continue;
         } else {
             $event = new Varien_Event($args);
             $event->setName($eventName);
             $observer = new Varien_Event_Observer();
         }
         foreach ($events[$eventName]['observers'] as $obsName => $obs) {
             $observer->setData(array('event' => $event));
             Varien_Profiler::start('OBSERVER: ' . $obsName);
             switch ($obs['type']) {
                 case 'disabled':
                     break;
                 case 'object':
                 case 'model':
                     $method = $obs['method'];
                     $observer->addData($args);
                     $object = Mage::getModel($obs['model']);
                     $this->_callObserverMethod($object, $method, $observer);
                     break;
                 default:
                     $method = $obs['method'];
                     $observer->addData($args);
                     $object = Mage::getSingleton($obs['model']);
                     $this->_callObserverMethod($object, $method, $observer);
                     break;
             }
             Varien_Profiler::stop('OBSERVER: ' . $obsName);
         }
     }
     return $this;
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:49,代码来源:App.php


注:本文中的Varien_Event::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。