@DI\Observe("claroline_tag_multiple_data")

@param GenericDataEvent $event
546867
public function onDataTag(GenericDataEvent $event)
    {
        $taggedObject = null;
        $data = $event->getData();

        if (is_array($data) && isset($data['tags']) && isset($data['data'])) {
            $user = isset($data['user']) ? $data['user'] : null;
            $replace = isset($data['replace']) && $data['replace'];
            $taggedObject = $this->manager->tagData($data['tags'], $data['data'], $user, $replace);
        }
        $event->setResponse($taggedObject);
    }
868913
public function publish(GenericEvent $event)
    {
        $legacyArticle = $event->getSubject();
        $arguments = $event->getArguments();

        if ($legacyArticle instanceof \Article) {
            $entry = $this->em
                ->getRepository('Newscoop\IngestPluginBundle\Entity\Feed\Entry')
                ->findOneByArticleId($legacyArticle->getArticleNumber());
            if ($entry !== null) {
                $entry->setPublished(new \DateTime($legacyArticle->getPublishDate()));
                $this->em->persist($entry);
                $this->em->flush();
            }
        }
    }
993420
public function detach($event, $callback){
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            $listeners = $this->removeListener($listeners, $eventObject, $callback);
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
207619
public function onPostListQueryBuilder(GenericEvent $event)
    {
        $queryBuilder = $event->getArgument('query_builder');

        // Request filters
        if ($event->hasArgument('request')) {
            $this->applyRequestFilters($queryBuilder, $event->getArgument('request')->get('filters', []));
        }

        // List form filters
        if ($event->hasArgument('entity')) {
            $entityConfig = $event->getArgument('entity');
            if (isset($entityConfig['list']['form_filters'])) {
                $listFormFiltersForm = $this->listFormFiltersHelper->getListFormFilters($entityConfig['list']['form_filters']);
                if ($listFormFiltersForm->isSubmitted() && $listFormFiltersForm->isValid()) {
                    $this->applyFormFilters($queryBuilder, $listFormFiltersForm->getData());
                }
            }
        }
    }
194313
protected function dispatchEvent(\Erebot\Interfaces\Event\Base\Generic $event)
    {
        $logger = \Plop\Plop::getInstance();
        $logger->debug(
            $this->bot->gettext('Dispatching "%(type)s" event.'),
            array('type' => get_class($event))
        );
        try {
            foreach ($this->events as $handler) {
                if ($handler->handleEvent($event) === false) {
                    break;
                }
            }
        } catch (\Erebot\ErrorReportingException $e) {
            // This should help make the code a little more "bug-free" (TM).
            $logger->exception($this->bot->gettext('Code is not clean!'), $e);
            $this->disconnect($e->getMessage());
        }
    }
123184
public function attach($event, $callback) {
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            if (!isset($listeners[$eventObject->getName()])) {
                $listeners[$eventObject->getName()] = array();
            }

            if (!in_array($callback, $listeners[$eventObject->getName()], true)) {
                $listeners[$eventObject->getName()][] = $callback;
            }
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
1117863
public function registerCallback( $event, $callback ) {

		if ( !is_string( $event ) ) {
			throw new InvalidArgumentException( "Event is not a string" );
		}

		if ( !is_callable( $callback ) ) {
			throw new RuntimeException( "Invoked object is not a valid callback or Closure" );
		}

		$this->addToCollection( $event, new GenericCallbackEventListener( $callback ) );
	}
430726
public static function trigger(string $event, $data = []) {
		$result = null;
		if (isset(self::$events[$event])) {
			foreach (self::$events[$event] as $callback) {
				$result = Utils::call($callback, $data);
				if ($result !== null) {
					break;
				}
			}
		}
		return $result;
	}
1264103
public function onPostSearchQueryBuilder(GenericEvent $event)
    {
        $queryBuilder = $event->getArgument('query_builder');

        if ($event->hasArgument('request')) {
            $this->applyRequestFilters($queryBuilder, $event->getArgument('request')->get('filters', []));
        }
    }
772312
public function onDelete(GenericDataEvent $event)
    {
        /** @var UserEntity[] $users */
        $users = $event->getData();

        $ids = [];
        foreach ($users as $user) {
            $ids[] = $user->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(UserEntity::class, $ids);
    }
1182171
public function updateAttributePosition(UpdatePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $this->genericUpdatePosition(AttributeTemplateQuery::create(), $event, $dispatcher);
    }
849617
public function onResourcesDelete(GenericDatasEvent $event)
    {
        $resources = $event->getDatas();
        $ids = array();

        foreach ($resources as $resource) {
            $ids[] = $resource->getId();
        }
        $this->tagManager->removeTaggedObjectsByClassAndIds(
            'Claroline\CoreBundle\Entity\Resource\ResourceNode',
            $ids
        );
    }
504784
public function update(GenericEvent $event)
    {
        $originalAnswers = new ArrayCollection();

        foreach ($event->getSubject()->getAnswers()->getSnapshot() as $answer) {
            $originalAnswers->add($answer);
        }

        /** @var ArrayCollection $answers */
        $answers = $event->getSubject()->getAnswers();

        foreach ($originalAnswers as $answer) {
            if ($answers->contains($answer) == false) {
                $answers->removeElement($answer);

                $this->manager->persist($answer);
                $this->manager->remove($answer);
            }
        }
    }
3484
protected function getPlaceholders(GenericEvent $event)
    {
        return array(
            '%eventname%' => $event['eventname'],
            '%source%'    => $event['source'],
            '%filename%'  => $event->hasArgument('file') ? $event['file'] : '',
            '%error%'     => $event->hasArgument('error') ? $event['error'] : '',
            '%profile%'   => $event->hasArgument('profile') ? $event['profile'] : '',
            '%message%'   => $event->hasArgument('message') ? $event['message'] : '',
        );
    }
719069
public static function trigger($name, Event $data)
    {
        if (self::$dispatcher) {
            if (!is_array($name)) {
                $name=array($name);
            }
            foreach ($name as $n) {
                call_user_func_array(self::$dispatcher, self::$dispatcher_args)->dispatch($n, $data);
            }
        }
    }
739063
public function registerEvent(string $event, ?string $table = null, \Closure $action): void
    {
        $this->events[$table ?? static::TABLE_ANY][$event] = $action;
    }
218366
public function onDelete(GenericDataEvent $event)
    {
        /** @var ResourceNode[] $resources */
        $resources = $event->getData();

        $ids = [];
        foreach ($resources as $resource) {
            $ids[] = $resource->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(ResourceNode::class, $ids);
    }