Attaches the given entity-changed listener.

@param EntityChangedListenerInterface $listener
173191
public function addEntityChangedListener(EntityChangedListenerInterface $listener)
    {
        if (!$this->listeners->hasItem($listener)) {
            $this->listeners->push($listener);
        }
    }
1350188
public function addEventListener(callable $listener): void
    {
        /** @var \Jasny\EventDispatcher\EventDispatcher $dispatcher */
        $dispatcher = type_check(
            $this->getEventDispatcher(),
            'Jasny\EventDispatcher\EventDispatcher',
            new LogicException('Unsupported event dispatcher. Please overload the addEventListener method.')
        );

        /** @var \Jasny\EventDispatcher\ListenerProvider $provider */
        $provider = type_check(
            $dispatcher->getListenerProvider(),
            'Jasny\EventDispatcher\ListenerProvider',
            new UnexpectedValueException('Unsupported listener provider; expected %2s, got %1s')
        );

        $newProvider = $provider->withListener($listener);
        $newDispatcher = $dispatcher->withListenerProvider($newProvider);

        $this->setEventDispatcher($newDispatcher);
    }
344874
private function attachEntityListeners(
        array $classAnnotations,
        ReflectionClass $reflectionClass,
        Mapping\ClassMetadata $metadata
    ) : void {
        // Evaluate @EntityListeners annotation
        if (isset($classAnnotations[Annotation\EntityListeners::class])) {
            /** @var Annotation\EntityListeners $entityListenersAnnot */
            $entityListenersAnnot = $classAnnotations[Annotation\EntityListeners::class];

            foreach ($entityListenersAnnot->value as $listenerClassName) {
                if (! class_exists($listenerClassName)) {
                    throw Mapping\MappingException::entityListenerClassNotFound(
                        $listenerClassName,
                        $metadata->getClassName()
                    );
                }

                $listenerClass = new ReflectionClass($listenerClassName);

                /** @var ReflectionMethod $method */
                foreach ($listenerClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                    foreach ($this->getMethodCallbacks($method) as $callback) {
                        $metadata->addEntityListener($callback, $listenerClassName, $method->getName());
                    }
                }
            }
        }
    }
992064
public function removeEventListener($listener)
	{
		$this->ensureEventListeners();
		
		unset($this->_eventListeners[Ioc::resolveClassName($listener)]);
		
		return $this;
	}
22966
public static function removeRoleEnvironmentChangingListener($listener)
    {
        foreach (self::$_changingListeners as $key => $changingListener) {
            if ($changingListener == $listener) {
                unset(self::$_changingListeners[$key]);

                return true;
            }
        }

        return false;
    }
865009
public void addListener(SettingsEntityListener settingsEntityListener) {
    RunAsSystemAspect.runAsSystem(
        () ->
            entityListenersService.addEntityListener(
                entityTypeId,
                new EntityListener() {
                  @Override
                  public void postUpdate(Entity entity) {
                    settingsEntityListener.postUpdate(entity);
                  }

                  @Override
                  public Object getEntityId() {
                    return getEntityType().getId();
                  }
                }));
  }
467222
public void addlistener(final ChangeListener listener) {
        synchronized (LISTENER_LOCK) {
            if (listeners.contains(listener)) {
                LOGGER.warn("Skip listener registration. listener[" + listener + "] is already registered!");
                return;
            }
            listeners.add(listener);
        }
    }
1133003
public function removeListener(ListenerInterface $listener)
    {
        if (false !== ($pos = array_search($listener, $this->collection_listeners, true))) {
            array_splice($this->collection_listeners, $pos, 1);
        }
    }
1236582
public void addListener(ChangeListener listener) {
        synchronized (hsChangeListeners) {
            hsChangeListeners.add(listener);
            changeListenerCount = hsChangeListeners.size();
            bUpdateChangeListener = true;
        }
    }
276960
public static function register($event, $listener) {
            if (!is_subclass_of($listener, Listener::class)) {
                throw new RegisterNonListenerException();
            }

            foreach (self::$listeners as $ev => $registered_listeners) {
                if ($ev & $event && !in_array($listener, $registered_listeners)) {
                    self::$listeners[ $ev ][] = $listener;
                }
            }
        }
1281199
public void addPostSelectionChangedListener(
			ISelectionChangedListener listener)
	{
		if (fOutlineViewer != null)
		{
			fOutlineViewer.addPostSelectionChangedListener(listener);
		} else
		{
			fPostSelectionChangedListeners.add(listener);
		}
	}
437817
public function addListener(string $event, $listener)
    {
        if (!isset($this->listeners[$event])) {
            $this->listeners[$event] = [];
        }
        $this->listeners[$event][] = $listener;
    }
450112
public void addEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope) {

        if (m_observerdEntity == null) {
            throw new RuntimeException("The Observer has been cleared, no listener registration possible.");
        }
        if (!m_changeListeners.containsKey(changeScope)) {
            m_changeListeners.put(changeScope, new ArrayList<I_CmsEntityChangeListener>());
            // if changeScope==null, it is a global change listener, and we don't need a scope value
            if (changeScope != null) {
                // save the current change scope value
                m_scopeValues.put(changeScope, CmsContentDefinition.getValueForPath(m_observerdEntity, changeScope));
            }
        }
        m_changeListeners.get(changeScope).add(changeListener);
    }
180786
public function change(LanguageListener $listener, $locale)
    {
        try {
            Session::put('locale', $locale);
            app()->setLocale($locale);
            return $listener->changeSuccess();
        } catch (Exception $e) {
            Log::warning($e);
            return $listener->changeFailed($e->getMessage());
        }
    }
771536
public function addListener(DBListener $listener, $name = null)
	{
		if($name !== null)
			$this->listeners->offsetSet($name, $listener);
		else
			$this->listeners->append($listener);
	}
852173
def attach(self, listener):
        
        if listener not in self.listeners:
            self.listeners.append(listener)
650009
public function registerListener( eZClusterEventListener $listener )
    {
        $suppliedEvents = array(
            'cluster/storeMetadata',
            'cluster/loadMetadata',
            'cluster/fileExists',
            'cluster/deleteFile',
            'cluster/deleteByLike',
            'cluster/deleteByDirList',
            'cluster/deleteByNametrunk'
        );

        foreach ( $suppliedEvents as $eventName )
        {
            list( $domain, $method ) = explode( '/', $eventName );
            $this->eventHandler->attach( $eventName, array( $listener, $method ) );
        }
    }