Esempio n. 1
0
 /**
  * @param array|string $unsubscribe
  * @param Doctrine\Common\EventSubscriber|array $subscriber
  */
 public function removeEventListener($unsubscribe, $subscriber = NULL)
 {
     foreach ((array) $unsubscribe as $eventName) {
         if (array_key_exists($eventName, $this->listenerIds)) {
             $this->initializeListener($eventName);
         }
     }
     parent::removeEventListener($unsubscribe, $subscriber);
 }
Esempio n. 2
0
 /**
  * @param array|string $unsubscribe
  * @param Doctrine\Common\EventSubscriber|array $subscriber
  */
 public function removeEventListener($unsubscribe, $subscriber = NULL)
 {
     if ($unsubscribe instanceof EventSubscriber) {
         list($unsubscribe, $subscriber) = $this->extractSubscriber($unsubscribe);
     }
     foreach ((array) $unsubscribe as $eventName) {
         if (array_key_exists($eventName, $this->listenerIds)) {
             $this->initializeListener($eventName);
         }
     }
     parent::removeEventListener($unsubscribe, $subscriber);
 }
 /**
  * {@inheritDoc}
  */
 public function removeEventListener($unsubscribe, $subscriber = NULL)
 {
     if ($unsubscribe instanceof Doctrine\Common\EventSubscriber) {
         $subscriber = $unsubscribe;
         $unsubscribe = [];
         foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
             if (is_array($params) && is_array($params[0]) || !is_numeric($eventName)) {
                 // [EventName => [[method, priority], ...], ...]
                 // [EventName => [method, priority], ...] && [EventName => method, .
                 $unsubscribe[] = $eventName;
             } else {
                 // [EventName, ...]
                 $unsubscribe[] = $params;
             }
         }
     }
     $namespace = $this->namespace;
     $unsubscribe = array_map(function ($eventName) use($namespace) {
         list($ns, $event) = Event::parseName($eventName);
         return $ns === NULL ? $namespace . $event : $eventName;
     }, (array) $unsubscribe);
     $this->evm->removeEventListener($unsubscribe, $subscriber);
 }