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


PHP Varien_Event_Observer::addData方法代码示例

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


在下文中一共展示了Varien_Event_Observer::addData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testScheduleOrderSync

 /**
  * @test
  * @loadFixture
  */
 public function testScheduleOrderSync()
 {
     $model = Mage::getModel("klevu_search/observer");
     $order = Mage::getModel("sales/order")->load(1);
     $event = new Varien_Event();
     $event->addData(array("event_name" => "sales_order_place_after", "order" => $order));
     $observer = new Varien_Event_Observer();
     $observer->addData(array("event" => $event));
     $model->scheduleOrderSync($observer);
     $this->assertEquals(array(array("order_item_id" => "2")), $this->getOrderSyncQueue());
     $this->assertEquals(1, $this->getOrderSyncCronScheduleCollection()->getSize(), "Failed to assert that scheduleOrderSync() schedules the Order Sync cron when called.");
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:16,代码来源:Observer.php

示例3: 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

示例4: helperGenerateObserver

 /**
  * Generates observer object
  *
  * @param array $eventData
  * @param string $eventName
  *
  * @return Varien_Event_Observer
  */
 public function helperGenerateObserver($eventData, $eventName = null)
 {
     $event = new Varien_Event($eventData);
     $observer = new Varien_Event_Observer();
     $observer->setEvent($event);
     if ($eventName) {
         $event->setName($eventName);
         $observer->setEventName($eventName);
     }
     $observer->addData($eventData);
     return $observer;
 }
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:20,代码来源:Observer.php

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