Exemplo n.º 1
0
 /**
  * beforeHandle
  *
  * Called before the crud action is executed
  *
  * @param CakeEvent $event
  * @return void
  */
 public function beforeHandle(CakeEvent $event)
 {
     parent::beforeHandle($event);
     if (!$this->_request()->is('api')) {
         $events = $this->implementedEvents();
         $eventManager = $this->_controller()->getEventManager();
         foreach (array_keys($events) as $name) {
             if ($name === 'Crud.beforeHandle') {
                 continue;
             }
             $eventManager->detach($this, $name);
         }
         return;
     }
     $this->_checkRequestMethods();
 }
 /**
  * Start timer for Crud.init
  *
  * And enable event logging. The Crud.initialize event will not itself have been logged
  *
  * @param CakeEvent $event
  * @return void
  */
 public function beforeHandle(CakeEvent $event)
 {
     parent::beforeHandle($event);
     DebugTimer::start('Event: Crud.beforeHandle');
 }