-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! IBX-6773: Bookmarks for non-accessible contents cause exceptio…
…n: Added BookmarkId sort clause
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
eZ/Publish/API/Repository/Values/Content/Query/SortClause/BookmarkId.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\API\Repository\Values\Content\Query\SortClause; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\Query; | ||
use eZ\Publish\API\Repository\Values\Content\Query\SortClause; | ||
use eZ\Publish\SPI\Repository\Values\Filter\FilteringSortClause; | ||
|
||
/** | ||
* Sets sort direction on the bookmark id for a location query containing a Bookmark criterion. | ||
*/ | ||
class BookmarkId extends SortClause implements FilteringSortClause | ||
{ | ||
/** | ||
* Constructs a new BookmarkId SortClause. | ||
* | ||
* @param string $sortDirection | ||
*/ | ||
public function __construct(string $sortDirection = Query::SORT_ASC) | ||
{ | ||
parent::__construct('id', $sortDirection); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...re/Persistence/Legacy/Filter/SortClauseQueryBuilder/Bookmark/IdSortClauseQueryBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\Core\Persistence\Legacy\Filter\SortClauseQueryBuilder\Bookmark; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\Query\SortClause\BookmarkId; | ||
use eZ\Publish\SPI\Persistence\Filter\Doctrine\FilteringQueryBuilder; | ||
use eZ\Publish\SPI\Repository\Values\Filter\FilteringSortClause; | ||
use eZ\Publish\SPI\Repository\Values\Filter\SortClauseQueryBuilder; | ||
|
||
class IdSortClauseQueryBuilder implements SortClauseQueryBuilder | ||
{ | ||
public function accepts(FilteringSortClause $sortClause): bool | ||
{ | ||
return $sortClause instanceof BookmarkId; | ||
} | ||
|
||
public function buildQuery( | ||
FilteringQueryBuilder $queryBuilder, | ||
FilteringSortClause $sortClause | ||
): void { | ||
/** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause */ | ||
$queryBuilder->addOrderBy('bookmark.id', $sortClause->direction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters