Skip to content
Snippets Groups Projects
Verified Commit b7931a14 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Fix wrong tag selection on the extbase query

parent 7799915b
No related branches found
No related tags found
1 merge request!44[BUGFIX] Fix bugs with fetching the related news
...@@ -583,9 +583,12 @@ class NewsRepository extends AbstractRepository { ...@@ -583,9 +583,12 @@ class NewsRepository extends AbstractRepository {
// "around" the given news, where newer news are preferred due to the ordering. // "around" the given news, where newer news are preferred due to the ordering.
$tags = $news->getTags(); $tags = $news->getTags();
if ($tags->count() > 0) { if ($tags->count() > 0) {
$tagConstraints = [];
foreach ($tags as $tag) { foreach ($tags as $tag) {
$constraints[] = $query->contains('tags', $tag); $tagConstraints[] = $query->contains('tags', $tag);
} }
$constraints[] = $query->logicalOr($tagConstraints);
} else { } else {
$constraints[] = $query->equals('pid', $news->getPid()); $constraints[] = $query->equals('pid', $news->getPid());
} }
......
...@@ -57,7 +57,7 @@ class RelatedViewHelper extends AbstractViewHelper { ...@@ -57,7 +57,7 @@ class RelatedViewHelper extends AbstractViewHelper {
$iterationData = [ $iterationData = [
'index' => 0, 'index' => 0,
'cycle' => 1, 'cycle' => 1,
'total' => count($related) 'total' => $related->count()
]; ];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment