From 0003ae415e2f1ddda5d329ad179f2c183dc21325 Mon Sep 17 00:00:00 2001 From: Oleksandr Zhyian Date: Wed, 29 May 2024 12:09:05 +0300 Subject: [PATCH] fix: correct ids relation in the degree programs overview shortcode --- src/Infrastructure/Repository/WpQueryArgs.php | 4 ++-- src/Infrastructure/Repository/WpQueryArgsBuilder.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Infrastructure/Repository/WpQueryArgs.php b/src/Infrastructure/Repository/WpQueryArgs.php index f2ff171..1baac33 100644 --- a/src/Infrastructure/Repository/WpQueryArgs.php +++ b/src/Infrastructure/Repository/WpQueryArgs.php @@ -39,12 +39,12 @@ public function withOrderBy(array $orderBy): self return $this->withArg('orderby', $orderBy); } - public function withTaxQueryItem(array $item): self + public function withTaxQueryItem(array $item, string $relation = 'AND'): self { $instance = clone $this; $instance->args['tax_query'] = (array) ($instance->args['tax_query'] - ?? ['relation' => 'AND']); + ?? ['relation' => $relation]); $instance->args['tax_query'][] = $item; diff --git a/src/Infrastructure/Repository/WpQueryArgsBuilder.php b/src/Infrastructure/Repository/WpQueryArgsBuilder.php index 7a6717f..76c5a13 100644 --- a/src/Infrastructure/Repository/WpQueryArgsBuilder.php +++ b/src/Infrastructure/Repository/WpQueryArgsBuilder.php @@ -119,7 +119,7 @@ public function applyHisCode(string $hisCode, WpQueryArgs $queryArgs): WpQueryAr ]; } - return $queryArgs->withTaxQueryItem($taxQueryItem); + return $queryArgs->withTaxQueryItem($taxQueryItem, 'OR'); } catch (RuntimeException) { /* * Return an empty result if one or more campo keys in HIS code are not matched to any terms.