Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct ids relation in the degree programs overview shortcode #8

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Infrastructure/Repository/WpQueryArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure/Repository/WpQueryArgsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down