diff --git a/Admin/ArticleContentNavigationProvider.php b/Admin/ArticleContentNavigationProvider.php
index da1181af0..06b0fe5fb 100644
--- a/Admin/ArticleContentNavigationProvider.php
+++ b/Admin/ArticleContentNavigationProvider.php
@@ -13,6 +13,7 @@
use Sulu\Bundle\AdminBundle\Navigation\ContentNavigationItem;
use Sulu\Bundle\AdminBundle\Navigation\ContentNavigationProviderInterface;
+use Sulu\Bundle\AdminBundle\Navigation\DisplayCondition;
/**
* Provides tabs for article-form.
@@ -35,6 +36,11 @@ public function getNavigationItems(array $options = [])
$seo->setAction('seo');
$seo->setComponent('articles/edit/seo@suluarticle');
$seo->setDisplay(['edit']);
+ $seo->setDisplayConditions(
+ [
+ new DisplayCondition('type', DisplayCondition::OPERATOR_EQUAL, null),
+ ]
+ );
$excerpt = new ContentNavigationItem('content-navigation.contents.excerpt');
$excerpt->setId('excerpt');
@@ -42,6 +48,11 @@ public function getNavigationItems(array $options = [])
$excerpt->setAction('excerpt');
$excerpt->setComponent('articles/edit/excerpt@suluarticle');
$excerpt->setDisplay(['edit']);
+ $excerpt->setDisplayConditions(
+ [
+ new DisplayCondition('type', DisplayCondition::OPERATOR_EQUAL, null),
+ ]
+ );
$settings = new ContentNavigationItem('content-navigation.contents.settings');
$settings->setId('settings');
@@ -49,6 +60,11 @@ public function getNavigationItems(array $options = [])
$settings->setAction('settings');
$settings->setComponent('articles/edit/settings@suluarticle');
$settings->setDisplay(['edit']);
+ $settings->setDisplayConditions(
+ [
+ new DisplayCondition('type', DisplayCondition::OPERATOR_EQUAL, null),
+ ]
+ );
return [$details, $seo, $excerpt, $settings];
}
diff --git a/Controller/ArticleController.php b/Controller/ArticleController.php
index e08a9fad0..5c9d73aef 100644
--- a/Controller/ArticleController.php
+++ b/Controller/ArticleController.php
@@ -21,6 +21,7 @@
use ONGR\ElasticsearchDSL\Query\TermQuery;
use ONGR\ElasticsearchDSL\Sort\FieldSort;
use Sulu\Bundle\ArticleBundle\Document\Form\ArticleDocumentType;
+use Sulu\Bundle\ArticleBundle\Metadata\ArticleViewDocumentIdTrait;
use Sulu\Component\Content\Form\Exception\InvalidFormException;
use Sulu\Component\DocumentManager\DocumentManagerInterface;
use Sulu\Component\Rest\Exception\MissingParameterException;
@@ -40,6 +41,7 @@ class ArticleController extends RestController implements ClassResourceInterface
const DOCUMENT_TYPE = 'article';
use RequestParametersTrait;
+ use ArticleViewDocumentIdTrait;
/**
* Create field-descriptor array.
@@ -49,7 +51,7 @@ class ArticleController extends RestController implements ClassResourceInterface
private function getFieldDescriptors()
{
return [
- 'id' => new FieldDescriptor('id', 'public.id', true),
+ 'uuid' => new FieldDescriptor('uuid', 'public.id', true),
'typeTranslation' => new FieldDescriptor(
'typeTranslation',
'sulu_article.list.type',
@@ -86,6 +88,8 @@ public function cgetFieldsAction()
*/
public function cgetAction(Request $request)
{
+ $locale = $this->getRequestParameter($request, 'locale', true);
+
$restHelper = $this->get('sulu_core.list_rest_helper');
/** @var Manager $manager */
@@ -96,8 +100,12 @@ public function cgetAction(Request $request)
$limit = (int) $restHelper->getLimit();
$page = (int) $restHelper->getPage();
+ if (null !== $locale) {
+ $search->addQuery(new TermQuery('locale', $locale));
+ }
+
if (count($ids = array_filter(explode(',', $request->get('ids', ''))))) {
- $search->addQuery(new IdsQuery($ids));
+ $search->addQuery(new IdsQuery($this->getViewDocumentIds($ids, $locale)));
$limit = count($ids);
}
@@ -170,7 +178,7 @@ public function getAction($uuid, Request $request)
$uuid,
$locale,
[
- 'load_ghost_content' => false,
+ 'load_ghost_content' => true,
'load_shadow_content' => false,
]
);
@@ -199,6 +207,7 @@ public function postAction(Request $request)
$document->setAuthored(new \DateTime());
if (array_key_exists('authored', $data)) {
$document->setAuthored(new \DateTime($data['authored']));
+ unset($data['authored']);
}
$document->setAuthors($this->getAuthors($data));
@@ -240,6 +249,7 @@ public function putAction(Request $request, $uuid)
if (array_key_exists('authored', $data)) {
$document->setAuthored(new \DateTime($data['authored']));
+ unset($data['authored']);
}
$document->setAuthors($this->getAuthors($data));
diff --git a/Document/ArticleViewDocument.php b/Document/ArticleViewDocument.php
index c3a2580c4..0cb2e7256 100644
--- a/Document/ArticleViewDocument.php
+++ b/Document/ArticleViewDocument.php
@@ -28,12 +28,19 @@ class ArticleViewDocument implements ArticleViewDocumentInterface
*
* @Id
*/
+ protected $id;
+
+ /**
+ * @var string
+ *
+ * @Property(type="string", options={"analyzer": "keyword"})
+ */
protected $uuid;
/**
* @var string
*
- * @Property(type="string")
+ * @Property(type="string", options={"analyzer": "keyword"})
*/
protected $locale;
@@ -203,14 +210,40 @@ class ArticleViewDocument implements ArticleViewDocumentInterface
*/
protected $publishedState;
+ /**
+ * @var LocalizationStateViewObject
+ *
+ * @Embedded(class="SuluArticleBundle:LocalizationStateViewObject")
+ */
+ protected $localizationState;
+
/**
* @param string $uuid
*/
- public function __construct($uuid = null)
- {
+ public function __construct(
+ $uuid = null
+ ) {
$this->uuid = $uuid;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setId($id)
+ {
+ $this->id = $id;
+
+ return $this;
+ }
+
/**
* {@inheritdoc}
*/
@@ -436,7 +469,7 @@ public function getSeo()
/**
* {@inheritdoc}
*/
- public function setSeo($seo)
+ public function setSeo(SeoViewObject $seo)
{
$this->seo = $seo;
@@ -548,4 +581,22 @@ public function setPublishedState($publishedState)
return $this;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLocalizationState()
+ {
+ return $this->localizationState;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setLocalizationState(LocalizationStateViewObject $localizationState)
+ {
+ $this->localizationState = $localizationState;
+
+ return $this;
+ }
}
diff --git a/Document/ArticleViewDocumentInterface.php b/Document/ArticleViewDocumentInterface.php
index 8d9f73e98..66ec6e331 100644
--- a/Document/ArticleViewDocumentInterface.php
+++ b/Document/ArticleViewDocumentInterface.php
@@ -16,6 +16,22 @@
*/
interface ArticleViewDocumentInterface
{
+ /**
+ * Returns id.
+ *
+ * @return string
+ */
+ public function getId();
+
+ /**
+ * Set id.
+ *
+ * @param string $id
+ *
+ * @return $this
+ */
+ public function setId($id);
+
/**
* Returns uuid.
*
@@ -222,7 +238,7 @@ public function getSeo();
*
* @return $this
*/
- public function setSeo($seo);
+ public function setSeo(SeoViewObject $seo);
/**
* Returns authored.
@@ -319,4 +335,20 @@ public function getPublishedState();
* @return $this
*/
public function setPublishedState($publishedState);
+
+ /**
+ * Get localization state.
+ *
+ * @return LocalizationStateViewObject
+ */
+ public function getLocalizationState();
+
+ /**
+ * Set localization state.
+ *
+ * @param LocalizationStateViewObject $localizationState
+ *
+ * @return $this
+ */
+ public function setLocalizationState(LocalizationStateViewObject $localizationState);
}
diff --git a/Document/Index/ArticleGhostIndexer.php b/Document/Index/ArticleGhostIndexer.php
new file mode 100644
index 000000000..f2b1dff7d
--- /dev/null
+++ b/Document/Index/ArticleGhostIndexer.php
@@ -0,0 +1,130 @@
+webspaceManager = $webspaceManager;
+ $this->documentManager = $documentManager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function index(ArticleDocument $document)
+ {
+ $article = $this->createOrUpdateArticle($document, $document->getLocale());
+ $this->createOrUpdateGhosts($document);
+ $this->dispatchIndexEvent($document, $article);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function remove($document)
+ {
+ foreach ($this->webspaceManager->getAllLocalizations() as $localization) {
+ $articleId = $this->getArticleId($document->getUuid(), $localization->getLocale());
+ $this->removeArticle($articleId);
+ }
+ }
+
+ /**
+ * @param ArticleDocument $document
+ */
+ private function createOrUpdateGhosts(ArticleDocument $document)
+ {
+ $documentLocale = $document->getLocale();
+ /** @var Localization $localization */
+ foreach ($this->webspaceManager->getAllLocalizations() as $localization) {
+ $locale = $localization->getLocale();
+ if ($documentLocale !== $locale) {
+ // Try index the article ghosts.
+ $this->createOrUpdateArticle(
+ $this->documentManager->find(
+ $document->getUuid(),
+ $locale,
+ [
+ 'load_ghost_content' => true,
+ ]
+ ),
+ $localization->getLocale(),
+ LocalizationState::GHOST
+ );
+ }
+ }
+ }
+}
diff --git a/Document/Index/ArticleIndexer.php b/Document/Index/ArticleIndexer.php
index 99c883da8..777dd91b2 100644
--- a/Document/Index/ArticleIndexer.php
+++ b/Document/Index/ArticleIndexer.php
@@ -14,12 +14,16 @@
use ONGR\ElasticsearchBundle\Service\Manager;
use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
use Sulu\Bundle\ArticleBundle\Document\ArticleDocument;
+use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocument;
+use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocumentInterface;
use Sulu\Bundle\ArticleBundle\Document\Index\Factory\ExcerptFactory;
use Sulu\Bundle\ArticleBundle\Document\Index\Factory\SeoFactory;
+use Sulu\Bundle\ArticleBundle\Document\LocalizationStateViewObject;
use Sulu\Bundle\ArticleBundle\Event\Events;
use Sulu\Bundle\ArticleBundle\Event\IndexEvent;
use Sulu\Bundle\ArticleBundle\Metadata\ArticleTypeTrait;
use Sulu\Bundle\SecurityBundle\UserManager\UserManager;
+use Sulu\Component\Content\Document\LocalizationState;
use Sulu\Component\Content\Document\WorkflowStage;
use Sulu\Component\Content\Metadata\Factory\StructureMetadataFactoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -113,57 +117,75 @@ public function __construct(
}
/**
- * {@inheritdoc}
+ * Returns translation for given article type.
+ *
+ * @param string $type
+ *
+ * @return string
*/
- public function clear()
+ private function getTypeTranslation($type)
{
- $pageSize = 500;
- $repository = $this->manager->getRepository($this->documentFactory->getClass('article'));
- $search = $repository->createSearch()
- ->addQuery(new MatchAllQuery())
- ->setSize($pageSize);
-
- $count = $repository->count($repository->createSearch()->addQuery(new MatchAllQuery()));
- $maxPage = ceil($count / $pageSize);
- for ($page = 1; $page <= $maxPage; ++$page) {
- $search->setFrom(($page - 1) * $pageSize);
- foreach ($repository->execute($search) as $document) {
- $this->manager->remove($document);
- }
-
- $this->manager->commit();
+ if (!array_key_exists($type, $this->typeConfiguration)) {
+ return ucfirst($type);
}
- $this->manager->clearCache();
- $this->manager->flush();
+ $typeTranslationKey = $this->typeConfiguration[$type]['translation_key'];
+
+ return $this->translator->trans(
+ $typeTranslationKey,
+ [],
+ 'backend'
+ );
}
/**
- * {@inheritdoc}
+ * @param ArticleDocument $document
+ * @param ArticleViewDocument $article
*/
- public function setUnpublished($uuid)
+ protected function dispatchIndexEvent(ArticleDocument $document, ArticleViewDocument $article)
{
- $article = $this->manager->find($this->documentFactory->getClass('article'), $uuid);
-
- if (!$article) {
- return;
- }
-
- $article->setPublished(null);
- $article->setPublishedState(false);
-
- $this->manager->persist($article);
+ $this->eventDispatcher->dispatch(Events::INDEX_EVENT, new IndexEvent($document, $article));
}
/**
- * {@inheritdoc}
+ * @param string $uuid
+ * @param string $locale
+ *
+ * @return string
*/
- public function index(ArticleDocument $document)
+ protected function getArticleId($uuid, $locale)
{
- $article = $this->manager->find($this->documentFactory->getClass('article'), $document->getUuid());
+ return $uuid . '-' . $locale;
+ }
+
+ /**
+ * @param ArticleDocument $document
+ * @param string $locale
+ * @param string $localizationState
+ *
+ * @return ArticleViewDocumentInterface
+ */
+ protected function createOrUpdateArticle(
+ ArticleDocument $document,
+ $locale,
+ $localizationState = LocalizationState::LOCALIZED
+ ) {
+ $articleId = $this->getArticleId($document->getUuid(), $locale);
+ /** @var ArticleViewDocument $article */
+ $article = $this->manager->find($this->documentFactory->getClass('article'), $articleId);
+
if (!$article) {
$article = $this->documentFactory->create('article');
+ $article->setId($articleId);
$article->setUuid($document->getUuid());
+ $article->setLocale($locale);
+ } else {
+ // Only index ghosts when the article isn't a ghost himself.
+ if (LocalizationState::GHOST === $localizationState
+ && LocalizationState::GHOST !== $article->getLocalizationState()->state
+ ) {
+ return null;
+ }
}
$structureMetadata = $this->structureMetadataFactory->getStructureMetadata(
@@ -184,6 +206,12 @@ public function index(ArticleDocument $document)
$article->setPublished($document->getPublished());
$article->setPublishedState($document->getWorkflowStage() === WorkflowStage::PUBLISHED);
$article->setTypeTranslation($this->getTypeTranslation($this->getType($structureMetadata)));
+ $article->setLocalizationState(
+ new LocalizationStateViewObject(
+ $localizationState,
+ (LocalizationState::LOCALIZED === $localizationState) ? null : $document->getLocale()
+ )
+ );
$extensions = $document->getExtensionsData()->toArray();
$article->setExcerpt($this->excerptFactory->create($extensions['excerpt'], $document->getLocale()));
@@ -203,17 +231,20 @@ public function index(ArticleDocument $document)
}
}
- $this->eventDispatcher->dispatch(Events::INDEX_EVENT, new IndexEvent($document, $article));
-
$this->manager->persist($article);
+
+ return $article;
}
/**
- * {@inheritdoc}
+ * @param string $id
*/
- public function remove($document)
+ protected function removeArticle($id)
{
- $article = $this->manager->find($this->documentFactory->getClass('article'), $document->getUuid());
+ $article = $this->manager->find(
+ $this->documentFactory->getClass('article'),
+ $id
+ );
if (null === $article) {
return;
}
@@ -221,6 +252,16 @@ public function remove($document)
$this->manager->remove($article);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function remove($document)
+ {
+ $this->removeArticle(
+ $this->getArticleId($document->getUuid(), $document->getOriginalLocale())
+ );
+ }
+
/**
* {@inheritdoc}
*/
@@ -230,24 +271,54 @@ public function flush()
}
/**
- * Returns translation for given article type.
- *
- * @param string $type
- *
- * @return string
+ * {@inheritdoc}
*/
- private function getTypeTranslation($type)
+ public function clear()
{
- if (!array_key_exists($type, $this->typeConfiguration)) {
- return ucfirst($type);
+ $pageSize = 500;
+ $repository = $this->manager->getRepository($this->documentFactory->getClass('article'));
+ $search = $repository->createSearch()
+ ->addQuery(new MatchAllQuery())
+ ->setSize($pageSize);
+
+ $count = $repository->count($repository->createSearch()->addQuery(new MatchAllQuery()));
+ $maxPage = ceil($count / $pageSize);
+ for ($page = 1; $page <= $maxPage; ++$page) {
+ $search->setFrom(($page - 1) * $pageSize);
+ foreach ($repository->execute($search) as $document) {
+ $this->manager->remove($document);
+ }
+
+ $this->manager->commit();
}
- $typeTranslationKey = $this->typeConfiguration[$type]['translation_key'];
+ $this->manager->clearCache();
+ $this->manager->flush();
+ }
- return $this->translator->trans(
- $typeTranslationKey,
- [],
- 'backend'
- );
+ /**
+ * {@inheritdoc}
+ */
+ public function setUnpublished($uuid)
+ {
+ $article = $this->manager->find($this->documentFactory->getClass('article'), $uuid);
+
+ if (!$article) {
+ return;
+ }
+
+ $article->setPublished(null);
+ $article->setPublishedState(false);
+
+ $this->manager->persist($article);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function index(ArticleDocument $document)
+ {
+ $article = $this->createOrUpdateArticle($document, $document->getLocale());
+ $this->dispatchIndexEvent($document, $article);
}
}
diff --git a/Document/LocalizationStateViewObject.php b/Document/LocalizationStateViewObject.php
new file mode 100644
index 000000000..5e757a3b7
--- /dev/null
+++ b/Document/LocalizationStateViewObject.php
@@ -0,0 +1,47 @@
+state = $state;
+ $this->locale = $locale;
+ }
+}
diff --git a/Document/Serializer/ArticleSubscriber.php b/Document/Serializer/ArticleSubscriber.php
index aea9c1f72..b1a9d1136 100644
--- a/Document/Serializer/ArticleSubscriber.php
+++ b/Document/Serializer/ArticleSubscriber.php
@@ -93,7 +93,7 @@ public function addTypeOnPostSerialize(ObjectEvent $event)
}
$structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
- $visitor->addData('type', $context->accept($this->getType($structure->getStructure())));
+ $visitor->addData('articleType', $context->accept($this->getType($structure->getStructure())));
}
/**
diff --git a/Document/Subscriber/ArticleSubscriber.php b/Document/Subscriber/ArticleSubscriber.php
index 48f245170..890b88233 100644
--- a/Document/Subscriber/ArticleSubscriber.php
+++ b/Document/Subscriber/ArticleSubscriber.php
@@ -16,8 +16,10 @@
use Sulu\Bundle\ArticleBundle\Document\Index\IndexerInterface;
use Sulu\Bundle\RouteBundle\Entity\RouteRepositoryInterface;
use Sulu\Bundle\RouteBundle\Manager\RouteManagerInterface;
+use Sulu\Component\DocumentManager\DocumentManagerInterface;
use Sulu\Component\DocumentManager\Event\AbstractMappingEvent;
use Sulu\Component\DocumentManager\Event\ConfigureOptionsEvent;
+use Sulu\Component\DocumentManager\Event\FlushEvent;
use Sulu\Component\DocumentManager\Event\MetadataLoadEvent;
use Sulu\Component\DocumentManager\Event\RemoveEvent;
use Sulu\Component\DocumentManager\Event\UnpublishEvent;
@@ -54,25 +56,43 @@ class ArticleSubscriber implements EventSubscriberInterface
*/
private $entityManager;
+ /**
+ * @var DocumentManagerInterface
+ */
+ private $documentManager;
+
+ /**
+ * @var array
+ */
+ private $documents = [];
+
+ /**
+ * @var array
+ */
+ private $liveDocuments = [];
+
/**
* @param IndexerInterface $indexer
* @param IndexerInterface $liveIndexer
* @param RouteManagerInterface $routeManager
* @param RouteRepositoryInterface $routeRepository
* @param EntityManagerInterface $entityManager
+ * @param DocumentManagerInterface $documentManager
*/
public function __construct(
IndexerInterface $indexer,
IndexerInterface $liveIndexer,
RouteManagerInterface $routeManager,
RouteRepositoryInterface $routeRepository,
- EntityManagerInterface $entityManager
+ EntityManagerInterface $entityManager,
+ DocumentManagerInterface $documentManager
) {
$this->indexer = $indexer;
$this->liveIndexer = $liveIndexer;
$this->routeManager = $routeManager;
$this->routeRepository = $routeRepository;
$this->entityManager = $entityManager;
+ $this->documentManager = $documentManager;
}
/**
@@ -82,13 +102,14 @@ public static function getSubscribedEvents()
{
return [
Events::HYDRATE => [['handleHydrate', -500]],
- Events::PERSIST => [['handleRoute', 0], ['handleRouteUpdate', 0], ['handleIndex', -500]],
+ Events::PERSIST => [['handleRoute', 0], ['handleRouteUpdate', 0], ['handleScheduleIndex', -500]],
Events::REMOVE => [['handleRemove', -500], ['handleRemoveLive', -500]],
Events::METADATA_LOAD => 'handleMetadataLoad',
- Events::PUBLISH => [['handleIndexLive', 0], ['handleIndex', 0]],
+ Events::PUBLISH => [['handleScheduleIndexLive', 0], ['handleScheduleIndex', 0]],
Events::UNPUBLISH => 'handleUnpublish',
Events::CONFIGURE_OPTIONS => 'configureOptions',
- Events::REMOVE_DRAFT => ['handleIndex', -1024],
+ Events::REMOVE_DRAFT => ['handleScheduleIndex', -1024],
+ Events::FLUSH => [['handleFlush', -2048], ['handleFlushLive', -2048]],
];
}
@@ -104,7 +125,12 @@ public function handleHydrate(AbstractMappingEvent $event)
return;
}
- $document->setRoute($this->routeRepository->findByPath($document->getRoutePath(), $event->getLocale()));
+ $route = $this->routeRepository->findByPath($document->getRoutePath(), $document->getOriginalLocale());
+ if (!$route) {
+ return;
+ }
+
+ $document->setRoute($route);
}
/**
@@ -148,19 +174,84 @@ public function handleRouteUpdate(AbstractMappingEvent $event)
}
/**
- * Indexes for article-document.
+ * Schedule article document for index.
*
* @param AbstractMappingEvent $event
*/
- public function handleIndex(AbstractMappingEvent $event)
+ public function handleScheduleIndex(AbstractMappingEvent $event)
{
$document = $event->getDocument();
if (!$document instanceof ArticleDocument) {
return;
}
- $this->indexer->index($document);
+ $this->documents[$document->getUuid()] = [
+ 'uuid' => $document->getUuid(),
+ 'locale' => $document->getLocale(),
+ ];
+ }
+
+ /**
+ * Schedule article document for live index.
+ *
+ * @param AbstractMappingEvent $event
+ */
+ public function handleScheduleIndexLive(AbstractMappingEvent $event)
+ {
+ $document = $event->getDocument();
+ if (!$document instanceof ArticleDocument) {
+ return;
+ }
+
+ $this->liveDocuments[$document->getUuid()] = [
+ 'uuid' => $document->getUuid(),
+ 'locale' => $document->getLocale(),
+ ];
+ }
+
+ /**
+ * Index all scheduled article documents with default indexer.
+ *
+ * @param FlushEvent $event
+ */
+ public function handleFlush(FlushEvent $event)
+ {
+ if (count($this->documents) < 1) {
+ return;
+ }
+
+ foreach ($this->documents as $document) {
+ $this->indexer->index(
+ $this->documentManager->find($document['uuid'],
+ $document['locale']
+ )
+ );
+ }
$this->indexer->flush();
+ $this->documents = [];
+ }
+
+ /**
+ * Index all scheduled article documents with live indexer.
+ *
+ * @param FlushEvent $event
+ */
+ public function handleFlushLive(FlushEvent $event)
+ {
+ if (count($this->liveDocuments) < 1) {
+ return;
+ }
+
+ foreach ($this->liveDocuments as $document) {
+ $this->liveIndexer->index(
+ $this->documentManager->find(
+ $document['uuid'],
+ $document['locale']
+ )
+ );
+ }
+ $this->liveIndexer->flush();
+ $this->liveDocuments = [];
}
/**
diff --git a/Metadata/ArticleViewDocumentIdTrait.php b/Metadata/ArticleViewDocumentIdTrait.php
new file mode 100644
index 000000000..0ff5f807b
--- /dev/null
+++ b/Metadata/ArticleViewDocumentIdTrait.php
@@ -0,0 +1,46 @@
+getViewDocumentId($uuid, $locale);
+ }
+
+ return $ids;
+ }
+}
diff --git a/Resources/config/serializer/Document.ArticleViewDocument.xml b/Resources/config/serializer/Document.ArticleViewDocument.xml
index d3bbdbe71..1bf3b7587 100644
--- a/Resources/config/serializer/Document.ArticleViewDocument.xml
+++ b/Resources/config/serializer/Document.ArticleViewDocument.xml
@@ -1,7 +1,8 @@