Skip to content

Commit

Permalink
fix urls (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-rath authored and wachterjohannes committed Jan 22, 2020
1 parent f99d10b commit e448fc0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Document/Serializer/WebsiteArticleUrlsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function getSubscribedEvents()
return [
[
'event' => Events::POST_SERIALIZE,
'format' => 'array',
'format' => 'json',
'method' => 'addUrlsOnPostSerialize',
],
];
Expand All @@ -72,7 +72,7 @@ public function addUrlsOnPostSerialize(ObjectEvent $event)
$context = $event->getContext();
$request = $this->requestStack->getCurrentRequest();

if (!$article instanceof ArticleDocument || !$context->hasAttribute('website') || !$request) {
if (!$article instanceof ArticleDocument || !$context->hasAttribute('urls') || !$request) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions Resolver/ArticleContentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function resolve(ArticleInterface $article, int $pageNumber = 1)
->setSerializeNull(true)
->setGroups(['website', 'content'])
->setAttribute('pageNumber', $pageNumber)
->setAttribute('urls', true)
);

if ($article instanceof ArticlePageDocument) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testAddUrlsOnPostSerialize()
$visitor = $this->prophesize(SerializationVisitorInterface::class);

$context = $this->prophesize(SerializationContext::class);
$context->hasAttribute('website')->willReturn(true);
$context->hasAttribute('urls')->willReturn(true);

$entityId = '123-123-123';
$article->getUuid()->willReturn($entityId);
Expand Down

0 comments on commit e448fc0

Please sign in to comment.