Ejemplo n.º 1
0
 /**
  * Bootstrap the application
  *
  * Defines and binds the MvcEvent, and passes it the request, response, and
  * router. Attaches the ViewManager as a listener. Triggers the bootstrap
  * event.
  *
  * @param array $listeners List of listeners to attach.
  * @return Application
  */
 public function bootstrap(array $listeners = array())
 {
     $serviceManager = $this->serviceManager;
     $events = $this->events;
     $listeners = array_unique(array_merge($this->defaultListeners, $listeners));
     foreach ($listeners as $listener) {
         $events->attach($serviceManager->get($listener));
     }
     // Setup MVC Event
     $this->event = $event = new MvcEvent();
     $event->setTarget($this);
     $event->setApplication($this)->setRequest($this->request)->setResponse($this->response);
     // Trigger bootstrap events
     $events->trigger(MvcEvent::EVENT_BOOTSTRAP, $event);
     return $this;
 }