mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-15 01:48:43 +01:00
EntryRepository: refactor getBuilderForUntaggedByUser
Improve SQL performance by replacing size(e.tags) with a left join and a null condition Move the QueryBuilder logic into getRawBuilderForUntaggedByUser Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
b7c5fda512
commit
0636697289
@ -102,7 +102,7 @@ class EntryRepository extends EntityRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves untagged entries for a user.
|
||||
* Retrieve a sorted list of untagged entries for a user.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
@ -111,8 +111,21 @@ class EntryRepository extends EntityRepository
|
||||
public function getBuilderForUntaggedByUser($userId)
|
||||
{
|
||||
return $this
|
||||
->getSortedQueryBuilderByUser($userId)
|
||||
->andWhere('size(e.tags) = 0');
|
||||
->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve untagged entries for a user.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
* @return QueryBuilder
|
||||
*/
|
||||
public function getRawBuilderForUntaggedByUser($userId)
|
||||
{
|
||||
return $this->getQueryBuilderByUser($userId)
|
||||
->leftJoin('e.tags', 't')
|
||||
->andWhere('t.id is null');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user