Document/Serializer/ArticlePageSubscriber.php
public function addTitleOnPostSerialize(ObjectEvent $event)
    {
        $articlePage = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if (!$articlePage instanceof ArticlePageDocument) {
            return;
        }

        $visitor->addData('title', $context->accept($articlePage->getParent()->getTitle()));
    }
public function addTitleOnPostSerialize(ObjectEvent $event)
    {
        $articlePage = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if (!$articlePage instanceof ArticlePageDocument) {
            return;
        }

        $visitor->addData('title', $context->accept($articlePage->getParent()->getTitle()));
    }
public function addTitleOnPostSerialize ( ObjectEvent $ event ) { $ articlePage = $ event -> getObject ( ) ; $ visitor = $ event -> getVisitor ( ) ; $ context = $ event -> getContext ( ) ; if ( ! $ articlePage instanceof ArticlePageDocument ) { return ; } $ visitor -> addData ( 'title' , $ context -> accept ( $ articlePage -> getParent ( ) -> getTitle ( ) ) ) ; }
Append title to result.

@param ObjectEvent $event
Append title to result .