Skip to content

Commit 3c51f6e

Browse files
Limit terms to a single taxonomy in case they have the same slug #23
1 parent 95a2b51 commit 3c51f6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Processors/RelationshipProcessor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected function getEffectedEntries($relationship, $entryIds)
227227

228228
$this->effectedUsers = $users->keyBy('id')->all();
229229
} elseif ($relationship->rightType == 'term') {
230-
$terms = $this->getTermsByIds($entryIds);
230+
$terms = $this->getTermsByIds($relationship, $entryIds);
231231

232232
$this->effectedTerms = $terms->keyBy('slug')->all();
233233
}
@@ -248,15 +248,15 @@ private function getUsersByIds($userIds)
248248
return collect($users);
249249
}
250250

251-
private function getTermsByIds($termIds)
251+
private function getTermsByIds(EntryRelationship $relationship, $termIds)
252252
{
253253
$terms = [];
254254

255255
/** @var TermRepository $termsRepository */
256256
$termsRepository = app(TermRepository::class);
257257

258258
foreach ($termIds as $termId) {
259-
$term = $termsRepository->query()->where('slug', $termId)->first();
259+
$term = $termsRepository->whereTaxonomy($relationship->rightCollection)->where('slug', $termId)->first();
260260

261261
if ($term != null) {
262262
$terms[] = $term;

0 commit comments

Comments
 (0)