@@ -220,8 +220,8 @@ public function findAll(string $userId, QueryParameters $queryParams, bool $with
220220
221221 $ qb
222222 ->from ('*PREFIX*bookmarks ' , 'b ' )
223- ->innerJoin ('b ' , 'folder_tree ' , 'tree ' , 'tree.item_id = b.id AND tree.type = ' . $ qb ->createPositionalParameter (TreeMapper::TYPE_BOOKMARK ) .
224- ($ queryParams ->getSoftDeleted () ? ' AND tree.soft_deleted_at is NOT NULL ' : ' AND tree.soft_deleted_at is NULL ' ));
223+ ->innerJoin ('b ' , 'folder_tree ' , 'tree ' , 'tree.item_id = b.id AND tree.type = ' . $ qb ->createPositionalParameter (TreeMapper::TYPE_BOOKMARK )
224+ . ($ queryParams ->getSoftDeleted () ? ' AND tree.soft_deleted_at is NOT NULL ' : ' AND tree.soft_deleted_at is NULL ' ));
225225
226226 $ this ->_filterUrl ($ qb , $ queryParams );
227227 $ this ->_filterArchived ($ qb , $ queryParams );
@@ -298,9 +298,9 @@ private function _generateCTE(int $folderId, bool $withSoftDeleted) : array {
298298
299299 if ($ this ->getDbType () === 'mysql ' ) {
300300 // For mysql we can just throw these three queries together in a CTE
301- $ withRecursiveQuery = 'WITH RECURSIVE folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( ' .
302- $ baseCase ->getSQL () . ' UNION ALL ' . $ recursiveCase ->getSQL () .
303- ' UNION ALL ' . $ recursiveCaseShares ->getSQL () . ') ' ;
301+ $ withRecursiveQuery = 'WITH RECURSIVE folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( '
302+ . $ baseCase ->getSQL () . ' UNION ALL ' . $ recursiveCase ->getSQL ()
303+ . ' UNION ALL ' . $ recursiveCaseShares ->getSQL () . ') ' ;
304304 } else {
305305 // Postgres loves us dearly and doesn't allow two recursive references in one CTE, aaah.
306306 // So we nest them:
@@ -333,12 +333,12 @@ private function _generateCTE(int $folderId, bool $withSoftDeleted) : array {
333333 // then we need another instance of the first recursive case, duplicated here as secondRecursive case
334334 // to recurse into child folders of shared folders
335335 // Note: This doesn't cover cases where a shared folder is inside a shared folder.
336- $ withRecursiveQuery = 'WITH RECURSIVE folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( ' .
337- 'WITH RECURSIVE second_folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( ' .
338- 'WITH RECURSIVE inner_folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( ' .
339- $ baseCase ->getSQL () . ' UNION ALL ' . $ recursiveCase ->getSQL () . ') ' .
340- ' ' . $ secondBaseCase ->getSQL () . ' UNION ALL ' . $ recursiveCaseShares ->getSQL () . ') ' .
341- ' ' . $ thirdBaseCase ->getSQL () . ' UNION ALL ' . $ secondRecursiveCase ->getSQL () . ') ' ;
336+ $ withRecursiveQuery = 'WITH RECURSIVE folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( '
337+ . 'WITH RECURSIVE second_folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( '
338+ . 'WITH RECURSIVE inner_folder_tree(item_id, parent_folder, type, idx, soft_deleted_at) AS ( '
339+ . $ baseCase ->getSQL () . ' UNION ALL ' . $ recursiveCase ->getSQL () . ') '
340+ . ' ' . $ secondBaseCase ->getSQL () . ' UNION ALL ' . $ recursiveCaseShares ->getSQL () . ') '
341+ . ' ' . $ thirdBaseCase ->getSQL () . ' UNION ALL ' . $ secondRecursiveCase ->getSQL () . ') ' ;
342342 }
343343
344344 // Now we need to concatenate the params of all these queries for downstream assembly of the greater query
0 commit comments