diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index d3170ebf4..c9e619ea1 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -11,6 +11,7 @@ namespace Sulu\Bundle\ArticleBundle\DependencyInjection; +use Sulu\Bundle\ArticleBundle\Document\ArticlePageViewObject; use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocument; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -58,6 +59,12 @@ public function getConfigTreeBuilder() ->scalarNode('view')->defaultValue(ArticleViewDocument::class)->end() ->end() ->end() + ->arrayNode('article_page') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('view')->defaultValue(ArticlePageViewObject::class)->end() + ->end() + ->end() ->end() ->end() ->arrayNode('types') diff --git a/Document/Index/ArticleIndexer.php b/Document/Index/ArticleIndexer.php index e4b33ede7..74c6217f6 100644 --- a/Document/Index/ArticleIndexer.php +++ b/Document/Index/ArticleIndexer.php @@ -16,7 +16,6 @@ use ONGR\ElasticsearchDSL\Query\MatchAllQuery; use ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery; use Sulu\Bundle\ArticleBundle\Document\ArticleDocument; -use Sulu\Bundle\ArticleBundle\Document\ArticlePageViewObject; use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocumentInterface; use Sulu\Bundle\ArticleBundle\Document\Index\Factory\ExcerptFactory; use Sulu\Bundle\ArticleBundle\Document\Index\Factory\SeoFactory; @@ -275,7 +274,7 @@ private function mapPages(ArticleDocument $document, ArticleViewDocumentInterfac { $pages = []; foreach ($document->getChildren() as $child) { - $pages[] = $page = new ArticlePageViewObject(); + $pages[] = $page = $this->documentFactory->create('article_page'); $page->uuid = $child->getUuid(); $page->pageNumber = $child->getPageNumber(); $page->title = $child->getPageTitle();