Exemple #1
0
 public function toggleActivation(HookToggleActivationEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($hook = HookQuery::create()->findPk($event->getHookId()))) {
         $hook->setActivate(!$hook->getActivate())->save();
         $event->setHook($hook);
         $this->cacheClear($dispatcher);
     }
 }
Exemple #2
0
 public function toggleHookActivation(HookToggleActivationEvent $event)
 {
     if ($event->hasHook()) {
         $hook = $event->getHook();
         ModuleHookQuery::create()->filterByHookId($hook->getId())->update(array('HookActive' => $hook->getActivate()));
         $this->cacheClear($event->getDispatcher());
     }
 }
Exemple #3
0
 /**
  * @params HookModel $hook
  * @depends testDeactivation
  */
 public function testToggleActivation(HookModel $hook)
 {
     $event = new HookToggleActivationEvent($hook->getId());
     $event->setDispatcher($this->dispatcher);
     $this->action->toggleActivation($event);
     $updatedHook = $event->getHook();
     $this->assertTrue($updatedHook->getActivate());
     return $hook;
 }