當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。