Completed
Push — ezp-30646 ( 6400c7...ee4911 )
by
unknown
21:35
created

SectionEventSubscriber::onAssignSection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 7
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace eZ\Publish\Core\Search\Common\EventSubscriber;
4
5
use eZ\Publish\Core\Event\Section\AssignSectionEvent;
6
use eZ\Publish\Core\Event\Section\SectionEvents;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
9
class SectionEventSubscriber extends AbstractSearchEventSubscriber implements EventSubscriberInterface
10
{
11
    public static function getSubscribedEvents(): array
12
    {
13
        return [
14
            SectionEvents::ASSIGN_SECTION => 'onAssignSection',
15
        ];
16
    }
17
18 View Code Duplication
    public function onAssignSection(AssignSectionEvent $event)
19
    {
20
        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id);
21
        $this->searchHandler->indexContent(
22
            $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo)
23
        );
24
    }
25
}