类Mage_Core_Model_App上的Observer在函数运行中结束

时间:2014-02-07 18:31:55

标签: php magento

app\code\core\Mage\Core\Model\App.php

public function run($params)
    {
        $options = isset($params['options']) ? $params['options'] : array();
        $this->baseInit($options);
        Mage::register('application_params', $params);

        if ($this->_cache->processRequest()) {
            $this->getResponse()->sendResponse();
        } else {
            $this->_initModules();
            $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);

            if ($this->_config->isLocalConfigLoaded()) {
                $scopeCode = isset($params['scope_code']) ? $params['scope_code'] : '';
                $scopeType = isset($params['scope_type']) ? $params['scope_type'] : 'store';
                $this->_initCurrentStore($scopeCode, $scopeType);
                $this->_initRequest();
                Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
            }

            $this->getFrontController()->dispatch();
        }
        return $this;
    }

我知道要创建一个事件/观察者,我需要执行以下操作:

<events>
  <EVENT_TO_HOOK>
    <observers>
      <module>
        <type>singleton</type>
        <class>company_module_model_observer</class>
        <method>methodToCall</method>
      </module>
    </observers>
  </EVENT_TO_HOOK>     
</events>

但我不知道如何捕捉班级run

Mage_Core_Model_App函数的事件

为了观察这个功能,事件的名称是什么?

1 个答案:

答案 0 :(得分:1)

在Magento的调度中,此时没有观察者。这是系统级代码,并不意味着受到扩展开发人员的干扰。您可以在Magento中使用观察员的唯一地方是

Mage::dispatchEvent('event_name' ...)