vendor/ibexa/core/src/lib/Search/Common/EventSubscriber/SectionEventSubscriber.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. namespace Ibexa\Core\Search\Common\EventSubscriber;
  7. use Ibexa\Contracts\Core\Repository\Events\Section\AssignSectionEvent;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. class SectionEventSubscriber extends AbstractSearchEventSubscriber implements EventSubscriberInterface
  10. {
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         return [
  14.             AssignSectionEvent::class => 'onAssignSection',
  15.         ];
  16.     }
  17.     public function onAssignSection(AssignSectionEvent $event)
  18.     {
  19.         $contentInfo $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id);
  20.         $this->searchHandler->indexContent(
  21.             $this->persistenceHandler->contentHandler()->load($contentInfo->id$contentInfo->currentVersionNo)
  22.         );
  23.     }
  24. }
  25. class_alias(SectionEventSubscriber::class, 'eZ\Publish\Core\Search\Common\EventSubscriber\SectionEventSubscriber');