0

Look 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;
    }

I know that to create an event / observer I need to do the following:

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

but i dont know how to catch the event of the run function of the class Mage_Core_Model_App

what is the name of the event in order to observe this function?

  • If all that Mage::run() will do is dispatch front controller, why not observe the predispatch?? – philwinkle Feb 7 '14 at 18:52
  • You sure you want to "observe" this? Wouldn't you achieve the same by overriding the run method of Mage_Core_Model_App and putting parent::run() followed by your custom code that you would handle in the observer? – Kenny Feb 7 '14 at 19:12
  • I wanted to make a module to get data of getModelInstance, getNodeClassInstance and getResourceModelInstance of the class Mage_Core_Model_Config , any idea how I can do this – Jonatan Ribeiro dos Santos Feb 7 '14 at 19:16
  • What do you exactly mean saying I wanted to make a module to get data of getModelInstance, getNodeClassInstance and getResourceModelInstance of the class Mage_Core_Model_Config – oleksii.svarychevskyi Feb 7 '14 at 19:41
2

There is no way to catch the start or end of the Mage_Core_Model_App::run action.
And there is no way to extend the Mage_Core_Model_App class because it is instantiated using new.
You can copy the class in local codepool and do your magic there.
Or you can use the events available in the other methods. The first one dispatched I think it is controller_front_init_before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.