SQL and performance improvements (#2017)

This commit is contained in:
Kevin Papst
2020-10-23 00:31:53 +02:00
committed by GitHub
parent 6ed7ee76e7
commit 4533c994a3
14 changed files with 216 additions and 206 deletions

View File

@@ -56,6 +56,7 @@ final class ActivityIdLoader implements LoaderInterface
->getQuery()
->execute();
// global activities don't have projects
if (!empty($activities)) {
$projectIds = array_map(function (Activity $activity) {
if (null === $activity->getProject()) {
@@ -93,15 +94,15 @@ final class ActivityIdLoader implements LoaderInterface
->andWhere($qb->expr()->in('a.id', $ids))
->getQuery()
->execute();
$qb = $em->createQueryBuilder();
$qb->select('PARTIAL a.{id}', 'teams', 'teamlead')
->from(Activity::class, 'a')
->leftJoin('a.teams', 'teams')
->leftJoin('teams.teamlead', 'teamlead')
->andWhere($qb->expr()->in('a.id', $ids))
->getQuery()
->execute();
}
$qb = $em->createQueryBuilder();
$qb->select('PARTIAL a.{id}', 'teams', 'teamlead')
->from(Activity::class, 'a')
->leftJoin('a.teams', 'teams')
->leftJoin('teams.teamlead', 'teamlead')
->andWhere($qb->expr()->in('a.id', $ids))
->getQuery()
->execute();
}
}