File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ protected function beforePrepare(): bool
106106 $ this ->joinElementTable ('wishlist_items ' );
107107
108108 $ this ->subQuery ->innerJoin ('{{%wishlist_lists}} wishlist_lists ' , '[[wishlist_items.listId]] = [[wishlist_lists.id]] ' );
109+ $ this ->subQuery ->innerJoin ('{{%elements}} lists_elements ' , '[[wishlist_items.listId]] = [[lists_elements.id]] ' );
109110
110111 // And join the element table for the linked element, in order to fetch non-deleted linked elements
111112 $ this ->query ->leftJoin ('{{%elements}} element_item ' , '[[wishlist_items.elementId]] = [[element_item.id]] ' );
@@ -173,6 +174,14 @@ protected function beforePrepare(): bool
173174 $ this ->query ->andWhere (['element_item.dateDeleted ' => null ]);
174175 }
175176
177+ // Ensure that we respect the trashed param, in case the list has been deleted. We don't update the item's deleted
178+ // status (but we probably should!). TODO: querying only trashed items won't work for example...
179+ if ($ this ->trashed === false ) {
180+ $ this ->subQuery ->andWhere (['lists_elements.dateDeleted ' => null ]);
181+ } else if ($ this ->trashed === true ) {
182+ $ this ->subQuery ->andWhere (['not ' , ['lists_elements.dateDeleted ' => null ]]);
183+ }
184+
176185 return parent ::beforePrepare ();
177186 }
178187}
You can’t perform that action at this time.
0 commit comments