Skip to content

Commit

Permalink
Merge pull request #91 from extcode/90-error-finding-by-category-in-e…
Browse files Browse the repository at this point in the history
…ventrepository-v5dev

[BUGFIX] Find events by category equals to category
  • Loading branch information
extcode authored Sep 2, 2024
2 parents 9e0007e + 0fa29cd commit 343981d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Classes/Domain/Repository/EventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public function findDemanded(EventDemand $demand): QueryResultInterface
if (!empty($demand->getCategories())) {
$categoryConstraints = [];
foreach ($demand->getCategories() as $category) {
$categoryConstraints[] = $query->contains('category', $category);
$categoryConstraints[] = $query->equals('category', $category);
$categoryConstraints[] = $query->contains('categories', $category);
}
$constraints = $query->logicalOr($categoryConstraints);
$constraints[] = $query->logicalOr(...array_values($categoryConstraints));
}

if (!empty($constraints)) {
$query->matching(
$query->logicalAnd($constraints)
$query->logicalAnd(...array_values($constraints))
);
}

Expand Down

0 comments on commit 343981d

Please sign in to comment.