Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/integration/Core/Repository/LocationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit;
use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation;
use Ibexa\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase;
use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway;
use Ibexa\Core\Repository\Values\Content\ContentUpdateStruct;

Expand Down Expand Up @@ -2412,11 +2413,11 @@ public function testDeleteLocationDeletesRelatedBookmarks()
$connection = $this->getRawDatabaseConnection();
$query = $connection->createQueryBuilder();
$query
->select('COUNT(id)')
->from('ibexa_content_bookmark')
->select('COUNT(' . DoctrineDatabase::COLUMN_ID . ')')
->from(DoctrineDatabase::TABLE_BOOKMARKS)
->where(
$query->expr()->eq(
'node_id',
DoctrineDatabase::COLUMN_LOCATION_ID,
$query->createNamedParameter($childLocation->getId(), ParameterType::INTEGER)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Ibexa\Contracts\Core\Repository\PermissionResolver;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion as Criterion;
use Ibexa\Contracts\Core\Repository\Values\User\UserReference;
use Ibexa\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase;
use Ibexa\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location\IsBookmarkedQueryBuilder;
use Ibexa\Tests\Core\Persistence\Legacy\Filter\BaseCriterionVisitorQueryBuilderTestCase;

Expand All @@ -21,8 +22,9 @@ final class IsBookmarkedQueryBuilderTest extends BaseCriterionVisitorQueryBuilde
{
private const CURRENT_USER_ID = 14;

private const BOOKMARK_EXISTS_SUBQUERY = 'SELECT 1 FROM ibexa_content_bookmark bookmark WHERE '
. '(bookmark.user_id = :dcValue%1$d) AND (bookmark.node_id = location.node_id)';
private const BOOKMARK_EXISTS_SUBQUERY = 'SELECT 1 FROM ' . DoctrineDatabase::TABLE_BOOKMARKS . ' bookmark WHERE '
. '(bookmark.' . DoctrineDatabase::COLUMN_USER_ID . ' = :dcValue%1$d)'
. ' AND (bookmark.' . DoctrineDatabase::COLUMN_LOCATION_ID . ' = location.node_id)';

/**
* @return iterable<string, array{\Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion, string, array<string, int>}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Location\Bookmark\Id;
use Ibexa\Contracts\Core\Repository\Values\User\UserReference;
use Ibexa\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase;
use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway;
use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway;
use Ibexa\Core\Persistence\Legacy\Filter\SortClauseQueryBuilder\Location\Bookmark\IdSortClauseQueryBuilder;
use PHPUnit\Framework\TestCase;
Expand All @@ -28,7 +29,6 @@ final class IdSortClauseQueryBuilderTest extends TestCase
private const BOOKMARK_ALIAS = 'ibexa_sort_bookmark';
private const CONTENT_LOCATION_ALIAS = 'ibexa_sort_location';
private const SORT_ALIAS = 'ibexa_filter_sort_bookmark_id';
private const CONTENT_ITEM_TABLE = 'ezcontentobject';

/**
* Location filtering: "location" is the FROM table, so the bookmarks table is joined
Expand Down Expand Up @@ -185,7 +185,7 @@ private function createLocationFilteringQueryBuilder(): FilteringQueryBuilder
->from(LocationGateway::CONTENT_TREE_TABLE, 'location')
->join(
'location',
self::CONTENT_ITEM_TABLE,
ContentGateway::CONTENT_ITEM_TABLE,
'content',
'content.id = location.contentobject_id'
);
Expand All @@ -203,7 +203,7 @@ private function createContentFilteringQueryBuilder(): FilteringQueryBuilder
$queryBuilder = new FilteringQueryBuilder($this->createInMemoryConnection());
$queryBuilder
->select('content.id')
->from(self::CONTENT_ITEM_TABLE, 'content');
->from(ContentGateway::CONTENT_ITEM_TABLE, 'content');

return $queryBuilder;
}
Expand Down