Removed unneeded lines

This commit is contained in:
Alejandro Celaya 2022-01-23 17:45:13 +01:00
parent 066268765a
commit 11c6c9a2b8
2 changed files with 2 additions and 5 deletions

View file

@ -64,8 +64,8 @@
"cebe/php-openapi": "^1.5",
"devster/ubench": "^2.1",
"dms/phpunit-arraysubset-asserts": "^0.3.0",
"eaglewu/swoole-ide-helper": "dev-master",
"infection/infection": "^0.26",
"openswoole/ide-helper": "~4.9.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan-doctrine": "^1.0",

View file

@ -63,9 +63,6 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
$apiKey = $filtering?->apiKey();
$this->applySpecification($subQb, new WithInlinedApiKeySpecsEnsuringJoin($apiKey), 't');
$subQuery = $subQb->getQuery();
$subQuerySql = $subQuery->getSQL();
// A native query builder needs to be used here, because DQL and ORM query builders do not support
// sub-queries at "from" and "join" level.
// If no sub-query is used, the whole list is loaded even with pagination, making it very inefficient.
@ -77,7 +74,7 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
'COUNT(DISTINCT s.id) AS short_urls_count',
'COUNT(DISTINCT v.id) AS visits_count',
)
->from('(' . $subQuerySql . ')', 't')
->from('(' . $subQb->getQuery()->getSQL() . ')', 't')
->leftJoin('t', 'short_urls_in_tags', 'st', $nativeQb->expr()->eq('t.id_0', 'st.tag_id'))
->leftJoin('st', 'short_urls', 's', $nativeQb->expr()->eq('s.id', 'st.short_url_id'))
->leftJoin('st', 'visits', 'v', $nativeQb->expr()->eq('s.id', 'v.short_url_id'))