Skip to content

Commit

Permalink
added configuration for article-page object
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes committed May 8, 2017
1 parent e862d96 commit d45c1c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')
Expand Down
3 changes: 1 addition & 2 deletions Document/Index/ArticleIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d45c1c9

Please sign in to comment.