@DI\Observe("claroline_retrieve_tagged_objects")

@param GenericDatasEvent $event
163770
public function onRetrieveObjectsByTag(GenericDatasEvent $event)
    {
        $taggedObjects = array();
        $datas = $event->getDatas();

        if (is_array($datas) && isset($datas['tag']) && !empty($datas['tag'])) {
            $search = $datas['tag'];
            $user = isset($datas['user']) ? $datas['user'] : null;
            $withPlatform = isset($datas['with_platform']) && $datas['with_platform'];
            $strictSearch = isset($datas['strict']) ? $datas['strict'] : false;
            $class = isset($datas['class']) ? $datas['class'] : null;
            $objectResponse = isset($datas['object_response']) && $datas['object_response'];
            $orderedBy = isset($datas['ordered_by']) ? $datas['ordered_by'] : 'id';
            $order = isset($datas['order']) ? $datas['order'] : 'ASC';

            $objects = $this->tagManager->getTaggedObjects(
                $user,
                $withPlatform,
                $class,
                $search,
                $strictSearch
            );

            if (!is_null($class) && $objectResponse) {
                $ids = array();

                foreach ($objects as $object) {
                    $ids[] = $object->getObjectId();
                }
                $taggedObjects = $this->tagManager->getObjectsByClassAndIds(
                    $class,
                    $ids,
                    $orderedBy,
                    $order
                );
            } else {

                foreach ($objects as $object) {
                    $datas = array();
                    $datas['class'] = $object->getObjectClass();
                    $datas['id'] = $object->getObjectId();
                    $datas['name'] = $object->getObjectName();
                    $taggedObjects[] = $datas;
                }
            }
        }
        $event->setResponse($taggedObjects);
    }
156024
public function getData(GetDataEvent $event)
    {
        $options = $event->getOptions();
        if (DataSource::CONTEXT_WORKSPACE === $event->getContext()) {
            $options['hiddenFilters']['workspace'] = $event->getWorkspace()->getUuid();
        }

        $event->setData(
            $this->finder->search(User::class, $options)
        );

        $event->stopPropagation();
    }
122758
public function onTaskSerialize(ObjectEvent $event)
    {
        $object = $event->getObject();
        if (!$object instanceof TaskInterface) {
            return;
        }

        $handler = $this->handlerFactory->create($object->getHandlerClass());
        if ($handler instanceof AutomationTaskHandlerInterface) {
            $event->getVisitor()->addData('taskName', $handler->getConfiguration()->getTitle());
        }

        $executions = $this->taskExecutionRepository->findByTaskUuid($object->getTaskId());
        if (0 < count($executions)) {
            $event->getVisitor()->addData('status', $executions[0]->getStatus());
        }
    }
877239
public function onPostSerialize(ObjectEvent $event)
    {
        $visitor = $event->getVisitor();
        $document = $event->getObject();

        if (!$document instanceof PathBehavior || !$this->documentRegistry->hasDocument($document)) {
            return;
        }

        $visitor->addData('path', $this->documentInspector->getContentPath($document));
    }
1200545
public function recordThat(Message $event): void
    {
        if (! \array_key_exists($event->messageName(), $this->eventApplyMap)) {
            throw new \RuntimeException('Wrong event recording detected. Unknown event passed to GenericAggregateRoot: ' . $event->messageName());
        }

        $this->version += 1;

        $event = $event->withAddedMetadata('_aggregate_id', $this->aggregateId());
        $event = $event->withAddedMetadata('_aggregate_version', $this->version);
        $this->recordedEvents[] = $event;

        $this->apply($event);
    }
267864
public function trigger($event, $params = array()) {
        $eventObject = is_object($event) ? $event : new GenericEvent($event, $params);
        foreach ($this->getListeners($eventObject) as $callback) {
            if (is_array($callback) && count($callback) == 2) {
                list($key, $function) = $callback;
                if (is_string($key) && !class_exists($key) && $this->getServiceManager()->has($key)) {
                    $service = $this->getServiceManager()->get($key);
                    $callback = [$service, $function];
                }
            }
            call_user_func($callback, $eventObject);
        }
    }
385841
private function deserializeTags(Subject $subject, array $tags = [], array $options = [])
    {
        //  if ($this->hasOption(Transfer::PERSIST_TAG, $options)) {
        $event = new GenericDataEvent([
            'tags' => $tags,
            'data' => [
                [
                    'class' => Subject::class,
                    'id' => $subject->getUuid(),
                    'name' => $subject->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
        //}
    }
558445
public function sendUserRegistrationEmail(GenericEvent $event)
    {
        if ($this->systemSettingContext->get('security.user_verification')) {
            return;
        }

        $user = $event->getSubject();

        Assert::isInstanceOf($user, WebUserInterface::class);

        $this->emailSender->send(Emails::USER_REGISTRATION, [$user->getEmail()], ['user' => $user]);
    }
300461
public function getData(GetDataEvent $event)
    {
        $options = $event->getOptions();
        $options['hiddenFilters']['hidden'] = false;

        if (DataSource::CONTEXT_HOME === $event->getContext()) {
            $options['hiddenFilters']['displayable'] = true;
            $options['hiddenFilters']['model'] = false;
            $options['hiddenFilters']['personal'] = false;
        }

        $event->setData(
            $this->finder->search(Workspace::class, $options)
        );

        $event->stopPropagation();
    }
329306
public function getData(GetDataEvent $event)
    {
        $options = $event->getOptions();
        $options['hiddenFilters']['user'] = $this->tokenStorage->getToken()->getUser()->getId();

        $event->setData(
            $this->finder->search(Workspace::class, $options, [Options::SERIALIZE_LIST])
        );

        $event->stopPropagation();
    }
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();
            }
        }
    }
482823
public function setTags($post, $tags = [])
    {
        $event = new GenericDataEvent([
            'tags' => $tags,
            'data' => [
                [
                    'class' => 'Icap\BlogBundle\Entity\Post',
                    'id' => $post->getUuid(),
                    'name' => $post->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
    }
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'] : '',
        );
    }
1188570
private function handleRegister(AbstractMappingEvent $event)
    {
        $node = $event->getNode();
        $locale = $event->getLocale();

        if (!$this->documentRegistry->hasNode($node, $locale)) {
            $this->documentRegistry->registerDocument($event->getDocument(), $node, $locale);
        }
    }
1356804
protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {
        DataSetDef def = event.getDataSetDef();
        if (DataSetProviderType.SQL.equals(def.getProvider())) {
            String uuid = def.getUUID();
            staticDataSetProvider.removeDataSet(uuid);
        }
    }
32762
public function getData(GetDataEvent $event)
    {
        $options = $event->getOptions() ? $event->getOptions() : [];
        $options['hiddenFilters']['moderation'] = false;

        if (DataSource::CONTEXT_WORKSPACE === $event->getContext()) {
            $options['hiddenFilters']['workspace'] = $event->getWorkspace()->getUuid();
        } elseif (DataSource::CONTEXT_HOME === $event->getContext()) {
            $options['hiddenFilters']['anonymous'] = true;
        }
        $event->setData(
            $this->finder->search(Message::class, $options)
        );

        $event->stopPropagation();
    }
869296
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
    {
        /** @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */
        $metadata = $event->getClassMetadata();

        if ( ! isset($this->entityListeners[$metadata->name])) {
            return;
        }

        foreach ($this->entityListeners[$metadata->name] as $listener) {
            $metadata->addEntityListener($listener['event'], $listener['class'], $listener['method']);
        }

        unset($this->entityListeners[$metadata->name]);
    }