Document/Serializer/ArticleWebsiteSubscriber.php
public function appendPageData(ObjectEvent $event)
    {
        $article = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if ($article instanceof ArticlePageDocument) {
            $article = $article->getParent();
        }

        if (!$article instanceof ArticleDocument || !$context->attributes->containsKey('website')) {
            return;
        }

        $pageNumber = 1;
        if ($context->attributes->containsKey('pageNumber')) {
            $pageNumber = $context->attributes->get('pageNumber')->get();
        }

        $visitor->addData('page', $pageNumber);
        $visitor->addData('pages', $context->accept($article->getPages()));
    }
public function appendPageData(ObjectEvent $event)
    {
        $article = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if ($article instanceof ArticlePageDocument) {
            $article = $article->getParent();
        }

        if (!$article instanceof ArticleDocument || !$context->attributes->containsKey('website')) {
            return;
        }

        $pageNumber = 1;
        if ($context->attributes->containsKey('pageNumber')) {
            $pageNumber = $context->attributes->get('pageNumber')->get();
        }

        $visitor->addData('page', $pageNumber);
        $visitor->addData('pages', $context->accept($article->getPages()));
    }
public function appendPageData ( ObjectEvent $ event ) { $ article = $ event -> getObject ( ) ; $ visitor = $ event -> getVisitor ( ) ; $ context = $ event -> getContext ( ) ; if ( $ article instanceof ArticlePageDocument ) { $ article = $ article -> getParent ( ) ; } if ( ! $ article instanceof ArticleDocument || ! $ context -> attributes -> containsKey ( 'website' ) ) { return ; } $ pageNumber = 1 ; if ( $ context -> attributes -> containsKey ( 'pageNumber' ) ) { $ pageNumber = $ context -> attributes -> get ( 'pageNumber' ) -> get ( ) ; } $ visitor -> addData ( 'page' , $ pageNumber ) ; $ visitor -> addData ( 'pages' , $ context -> accept ( $ article -> getPages ( ) ) ) ; }
Append page data.

@param ObjectEvent $event
Append page data .