File tree 4 files changed +12
-2
lines changed
4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ class EntryRelationship
14
14
public $ leftType = '' ;
15
15
public $ rightType = '' ;
16
16
17
+ public $ taxonomyName = '' ;
18
+
17
19
public $ index = 0 ;
18
20
public $ type = self ::TYPE_MANY_TO_MANY ;
19
21
public $ leftCollection = '' ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function handle(TermDeleted $event)
27
27
return ;
28
28
}
29
29
30
- $ relationships = $ this ->manager ->getAllTermRelationships ( );
30
+ $ relationships = $ this ->manager ->getTermRelationshipsFor ( $ term -> taxonomy ()-> handle () );
31
31
32
32
$ this ->manager ->processor ()->setIsDeleting ()->setEntryId ($ term ->slug ())
33
33
->setPristineDetails ($ term , false )->process ($ relationships );
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function handle(TermSaved $event)
27
27
28
28
$ this ->manager ->processor ()->setUpdatedEntryDetails ($ term );
29
29
30
- $ relationships = $ this ->manager ->getAllTermRelationships ( );
30
+ $ relationships = $ this ->manager ->getTermRelationshipsFor ( $ term -> taxonomy ()-> handle () );
31
31
32
32
$ this ->manager ->processor ()->process ($ relationships );
33
33
}
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ public function term($termName)
78
78
$ relationship ->leftType = 'term ' ;
79
79
$ relationship ->leftField = $ termName ;
80
80
$ relationship ->leftCollection = '[term] ' ;
81
+ $ relationship ->taxonomyName = $ termName ;
81
82
82
83
if (! array_key_exists ('terms ' , $ this ->relationships )) {
83
84
$ this ->relationships ['terms ' ] = [];
@@ -351,6 +352,13 @@ public function getAllTermRelationships()
351
352
return $ this ->getEntityTypeRelationships ('terms ' );
352
353
}
353
354
355
+ public function getTermRelationshipsFor ($ term )
356
+ {
357
+ return collect ($ this ->getAllTermRelationships ())->filter (function (EntryRelationship $ relationship ) use ($ term ) {
358
+ return $ relationship ->leftType == 'term ' && $ relationship ->taxonomyName == $ term ;
359
+ })->all ();
360
+ }
361
+
354
362
public function getAllRelationships ()
355
363
{
356
364
$ relationships = [];
You can’t perform that action at this time.
0 commit comments