Добавляет поддержку сервисов

@param WorkflowTypeResolverEvent $event
340228
public function addServiceTypeResolver(WorkflowTypeResolverEvent $event)
    {
        $serviceTypeResolver = $this->getServiceResolver();
        $event->getChainTypeResolver()->add($serviceTypeResolver);
    }
908658
public function onPostCmdEvent(Event $event) {
    // Only install the template files if acquia/blt was installed.
    if (isset($this->bltPackage)) {
      $version = $this->bltPackage->getVersion();
      $this->executeBltUpdate($version);
    }
  }
1009156
public function injectSearch(Event $event)
    {
        if (!in_array($event->getName(), $this->getConfig('enabled'))) {
            return;
        }

        $repository = $this->_table();
        if ($repository instanceof Table && !$repository->behaviors()->has('Search')) {
            throw new RuntimeException(sprintf(
                'Missing Search.Search behavior on %s',
                get_class($repository)
            ));
        }

        if ($repository instanceof Table && $repository->behaviors()->hasMethod('filterParams')) {
            $filterParams = $repository->filterParams($this->_request()->getQuery());
        } else {
            $filterParams = ['search' => $this->_request()->getQuery()];
        }

        $filterParams['collection'] = $this->getConfig('collection');
        $event->getSubject()->query->find('search', $filterParams);
    }
334570
public function onDelete(DeleteResourceEvent $event)
    {
        $workspaceCode = $event->getResource()
            ->getResourceNode()
            ->getWorkspace()
            ->getCode();
        $pathName = $this->container->getParameter('claroline.param.files_directory') .
            DIRECTORY_SEPARATOR .
            $event->getResource()->getHashName();

        if (file_exists($pathName)) {
            $event->setFiles(array($pathName));
        }

        $event->stopPropagation();
    }
358940
public function onCreateForm(CreateFormResourceEvent $event)
    {
        $form = $this->container->get('form.factory')->create(new FileType(true), new File());
        $content = $this->container->get('templating')->render(
            'ClarolineCoreBundle:Resource:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => 'file'
            )
        );
        $event->setResponseContent($content);
        $event->stopPropagation();
    }
149486
public function setStructureTypeToParent(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument
            || LocalizationState::GHOST === $this->documentInspector->getLocalizationState($document->getParent())
            || $document->getStructureType() === $document->getParent()->getStructureType()
        ) {
            return;
        }

        $document->getParent()->setStructureType($document->getStructureType());
        $this->documentManager->persist($document->getParent(), $event->getLocale());
    }
343524
public function handleStopPropagationAndResetLocale(HydrateEvent $event)
    {
        if (!$event->hasDocument()) {
            return;
        }

        $locale = $event->getLocale();
        $document = $event->getDocument();
        $options = $event->getOptions();
        $originalLocale = $this->documentRegistry->getOriginalLocaleForDocument($document);

        if (
            (!isset($options['rehydrate']) || false === $options['rehydrate']) &&
            (true === $this->documentRegistry->isHydrated($document) && $originalLocale === $locale)
        ) {
            $event->stopPropagation();
        }
    }
993503
public void handleEvent(Event event) throws GitLabApiException {

        LOGGER.info("handleEvent: object_kind=" + event.getObjectKind());

        switch (event.getObjectKind()) {
        case BuildEvent.OBJECT_KIND:
        case IssueEvent.OBJECT_KIND:
        case MergeRequestEvent.OBJECT_KIND:
        case NoteEvent.OBJECT_KIND:
        case PipelineEvent.OBJECT_KIND:
        case PushEvent.OBJECT_KIND:
        case TagPushEvent.OBJECT_KIND:
        case WikiPageEvent.OBJECT_KIND:
            break;

        default:
            String message = "Unsupported event object_kind, object_kind=" + event.getObjectKind();
            LOGGER.warning(message);
            throw new GitLabApiException(message);
        }

        fireEvent(event);
    }
766791
@Override
    public void onEvent(EventIterator events) {
        try {
            // this resolver should be the only one (for this handling thread)
            ResourceResolver resolver = getResolver();
            if (resolver != null) {
                try {
                    Session session = resolver.adaptTo(Session.class);
                    String serviceUserId = getServiceUserId();
                    // collect changed nodes
                    ChangeCollection changedNodes = new ChangeCollection();
                    while (events.hasNext()) {
                        Event event = events.nextEvent();
                        if (ignoreEvent(event)) continue;
                        try {
                            String path = event.getPath();
                            String user = event.getUserID();
                            // if the service user is the initiator this is a self initiated event - ignore it
                            if (!serviceUserId.equals(user)) {
                                Calendar time = Calendar.getInstance();
                                time.setTime(new Date(event.getDate()));
                                int type = event.getType();
                                if (isPropertyEvent(type)) {
                                    if (getPropertyPathFilter().accept(path)) {
                                        changedNodes.registerChange(session, resolver, path, time, user);
                                    }
                                } else {
                                    if (getNodePathFilter().accept(path)) {
                                        changedNodes.registerChange(session, resolver, path, time, user);
                                    }
                                }
                            }
                        } catch (RepositoryException rex) {
                            LOG.error(rex.getMessage(), rex);
                        }
                    }
                    // handle change actions on the detected nodes
                    if (changedNodes.size() > 0) {
                        for (ChangedResource change : changedNodes.values()) {
                            try {
                                doOnChange(resolver, change);
                            } catch (RepositoryException ex) {
                                LOG.error(ex.getMessage(), ex);
                            }
                        }
                        changedNodes.clear();
                        resolver.commit();
                    }
                } catch (PersistenceException ex) {
                    LOG.error(ex.getMessage(), ex);
                } finally {
                    resolver.close();
                }
            }
        } catch (LoginException ex) {
            LOG.error(ex.getMessage(), ex);
        }
    }
461089
public function onDisplayWorkspaceLogs(DisplayToolEvent $event)
    {
        $event->setContent($this->workspaceLogs($event->getWorkspace()->getId()));
    }
937615
public function setWorkflowStageOnDocument(HydrateEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($event)) {
            return;
        }

        $node = $event->getNode();
        $locale = $event->getLocale();

        $document->setWorkflowStage(
            $node->getPropertyValueWithDefault(
                $this->propertyEncoder->localizedSystemName(self::WORKFLOW_STAGE_FIELD, $locale),
                WorkflowStage::TEST
            )
        );

        $event->getAccessor()->set(
            self::PUBLISHED_FIELD,
            $node->getPropertyValueWithDefault(
                $this->propertyEncoder->localizedSystemName(self::PUBLISHED_FIELD, $locale),
                null
            )
        );
    }
853670
public function handle(ProductTypeRepository $productTypeRepository, Dispatcher $event)
    {
        $productType = $productTypeRepository->find($this->id);

        // TODO : Check if the product type is in use

        $productTypeRepository->destroy($productType);

        $event->fire(new ProductTypeWasDestroyed($productType));

        return $productType;
    }
447112
public function onDisplayWorkspace(DisplayToolEvent $event)
    {
        $workspace = $event->getWorkspace();

        $content = $this->templating->render(
            'ClarolineCoreBundle:workspace:logs.html.twig', [
                'workspace' => $workspace,
                'actions' => $this->eventManager->getEventsForApiFilter(LogGenericEvent::DISPLAYED_WORKSPACE),
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
1245293
public function beforeFilter($event)
    {
        $this->setController($event->subject());

        if ($this->Controller->Manager->prefix('admin')) {
            if (method_exists($this->Controller, 'initPostTypes')) {
                $this->Controller->initPostTypes($event);
            }
        }
    }
465504
public function onPostSerialize(ObjectEvent $event)
    {
        /** @var Content $content */
        $content = $event->getObject();
        /** @var JsonSerializationVisitor $visitor */
        $visitor = $event->getVisitor();

        if (!($content instanceof Content)) {
            return;
        }

        foreach ($content->getData() as $key => $value) {
            $visitor->setData($key, $value);
        }

        $visitor->setData('publishedState', (WorkflowStage::PUBLISHED === $content->getWorkflowStage()));

        if (RedirectType::EXTERNAL === $content->getNodeType()) {
            $visitor->setData('linked', 'external');
        } elseif (RedirectType::INTERNAL === $content->getNodeType()) {
            $visitor->setData('linked', 'internal');
        }

        if (null !== $content->getLocalizationType()) {
            $visitor->setData('type', $content->getLocalizationType()->toArray());
        }

        $visitor->setData(
            '_permissions',
            $this->accessControlManager->getUserPermissionByArray(
                $content->getLocale(),
                PageAdmin::SECURITY_CONTEXT_PREFIX . $content->getWebspaceKey(),
                $content->getPermissions(),
                $this->tokenStorage->getToken()->getUser()
            )
        );
    }
1139900
public function onCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request');
        $form = $this->container->get('form.factory')->create(new FileType(true), new File());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->handleFileCreation($form, $event);
        }

        $content = $this->container->get('templating')->render(
            'ClarolineCoreBundle:Resource:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => $event->getResourceType()
            )
        );
        $event->setErrorFormContent($content);
        $event->stopPropagation();
    }
1367638
public function onApiCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request');
        $form = new FileType(true);
        $form->enableApi();
        $form = $this->container->get('form.factory')->create($form, new File());
        $form->submit($this->container->get('request'));


        if ($form->isValid()) {
            $this->handleFileCreation($form, $event);
        }

        $event->setErrorFormContent($form);
        $event->stopPropagation();
    }