Example #1
0
 /**
  * Initializes the current dmContext instance.
  *
  * @param dmApplicationConfiguration $configuration  An dmApplicationConfiguration instance
  */
 public function initialize(sfApplicationConfiguration $configuration)
 {
     $this->checkProjectIsSetup();
     parent::initialize($configuration);
     sfConfig::set('dm_debug', $this->getRequest()->getParameter('dm_debug', false));
     // load the service container instance
     $this->loadServiceContainer();
     // configure the service container with its required dependencies
     $this->configureServiceContainer($this->serviceContainer);
     if (method_exists($this->configuration, 'configureServiceContainer')) {
         $this->configuration->configureServiceContainer($this->serviceContainer);
     }
     // connect the service container and its services to the event dispatcher
     $this->serviceContainer->connect();
     /*
      * dmForm requires service container...
      */
     dmForm::setServiceContainer($this->serviceContainer);
     /*
      * some classes needs the event dispatcher to communicate
      * and the service container...
      */
     dmDoctrineQuery::setModuleManager($this->getModuleManager());
     dmDoctrineTable::setServiceContainer($this->serviceContainer);
     $this->helper = $this->serviceContainer->getService('helper');
     // notify that context is ready
     $this->dispatcher->notify(new sfEvent($this, 'dm.context.loaded'));
 }