Zend\Mvc\Controller\AbstractController::attachDefaultListeners PHP 메소드

attachDefaultListeners() 보호된 메소드

Register the default events for this controller
protected attachDefaultListeners ( ) : void
리턴 void
    protected function attachDefaultListeners()
    {
        $events = $this->getEventManager();
        $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch']);
    }

Usage Example

 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $this->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, function (MvcEvent $event) {
         $event->getTarget()->layout('layout/frontend/gallery');
     });
 }