Exemple #1
0
 private function getEventManager()
 {
     if (!$this->eventManager) {
         $this->eventManager = new EventManager();
         $this->eventManager->setIdentifiers(get_class($this));
     }
     return $this->eventManager;
 }
 /**
  * @return EventManagerInterface
  */
 private function createPrivateEventManager($eventClazz)
 {
     $events = new EventManager();
     $events->setIdentifiers(array('ZfcUserAdmin', $eventClazz));
     $events->setEventClass($eventClazz);
     return $events;
 }
 /**
  * @param \Zend\EventManager\EventManager $eventManager
  */
 public function let($eventManager)
 {
     $eventManager->trigger(Argument::cetera())->willReturn(true);
     $eventManager->setIdentifiers(Argument::cetera())->willReturn(true);
     $eventManager->attach(Argument::cetera())->willReturn(true);
     $this->setEventManager($eventManager);
 }
 public function createServiceWithName(ServiceLocatorInterface $serviceManager, $name, $requestedName)
 {
     $eventManager = new ZendEventManager();
     $entityEventManager = new EntityEventManager($eventManager);
     $entityParams = explode('\\', $requestedName);
     if (isset($entityParams[0])) {
         $eventManager->setIdentifiers($entityParams[0]);
     }
     return $entityEventManager;
 }
Exemple #5
0
 /**
  * Attempt to marshal an EventManager instance.
  *
  * If an instance is already available, return it.
  *
  * If the zend-eventmanager component is not present, return nothing.
  *
  * Otherwise, marshal the instance in a version-agnostic way, and return
  * it.
  *
  * @return null|EventManager
  */
 private function getEventManager()
 {
     if ($this->events) {
         return $this->events;
     }
     if (!class_exists(EventManager::class)) {
         return;
     }
     $this->events = new EventManager();
     $this->events->setIdentifiers([__CLASS__]);
     return $this->events;
 }
 /**
  * @param AdapterInterface|null $adapter
  * @return AuthResult
  */
 public function authenticate(AdapterInterface $adapter = null)
 {
     $event = new AuthenticationEvent();
     $event->setTarget($this);
     if (!$adapter) {
         $adapter = $this->adapter;
     }
     if ($adapter) {
         $event->setAdapter($adapter);
     }
     $eventManager = new EventManager();
     $eventManager->setIdentifiers(get_class($this));
     $eventManager->trigger($event);
     return $event->getResult();
 }
 /**
  * Set EventManager instance
  * 
  * @param EventManager $eventManager
  * 
  * @return void
  */
 public function setEventManager(EventManager $eventManager)
 {
     $this->eventManager = $eventManager;
     $this->eventManager->setIdentifiers(array('EventStore'));
 }
Exemple #8
0
 public function index09Action()
 {
     $eventManagerOne = new EventManager();
     //$eventManagerOne = new EventManager(array("emOne","emTwo"));
     $eventManagerOne->setIdentifiers(array("emOne", "emTwo"));
     $listener1 = $eventManagerOne->attach("eventOne", function ($e) {
         echo "<h3 style='color:red;font-weight:bold'>eventManagerOne - eventOne - Do 1</h3>";
     });
     $eventManagerOne->trigger("eventOne");
     $ids = $eventManagerOne->getIdentifiers();
     echo "<pre style='font-weight:bold'>";
     print_r($ids);
     echo "</pre>";
     return false;
 }
Exemple #9
0
 /**
  * Inject an EventManager instance
  *
  * @param  EventManagerInterface $eventManager
  *
  * @return void
  */
 public function setEventManager(EventManagerInterface $eventManager)
 {
     $this->eventManager = $eventManager;
     $this->eventManager->setIdentifiers(self::EVENT_MANAGER_IDENTIFIER);
 }