Release 2.22.0 (#5043)
This commit is contained in:
@@ -82,12 +82,14 @@ final class ActivityLoader implements LoaderInterface
|
||||
}
|
||||
|
||||
// required on "Activity listing" page for non super-admins
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL a.{id}', 'teams')
|
||||
->from(Activity::class, 'a')
|
||||
->leftJoin('a.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('a.id', $activityIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
if (\count($activityIds) > 0) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL a.{id}', 'teams')
|
||||
->from(Activity::class, 'a')
|
||||
->leftJoin('a.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('a.id', $activityIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +66,15 @@ final class CustomerLoader implements LoaderInterface
|
||||
$em = $this->entityManager;
|
||||
|
||||
// required where we need to check team permissions, e.g. "Customer listing"
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL c.{id}', 'teams')
|
||||
->from(Customer::class, 'c')
|
||||
->leftJoin('c.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('c.id', $customerIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
if (\count($customerIds) > 0) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL c.{id}', 'teams')
|
||||
->from(Customer::class, 'c')
|
||||
->leftJoin('c.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('c.id', $customerIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
}
|
||||
|
||||
// do not load team members or leads by default, because they will only be used on detail pages
|
||||
if ($hydrateTeamMembers) {
|
||||
|
||||
@@ -37,6 +37,7 @@ final class ProjectLoader implements LoaderInterface
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var array<int> $projectIds */
|
||||
$projectIds = array_filter(array_unique(array_map(function (Project $project) {
|
||||
// make sure that this potential doctrine proxy is initialized and filled with all data
|
||||
$project->getName();
|
||||
@@ -48,7 +49,7 @@ final class ProjectLoader implements LoaderInterface
|
||||
|
||||
$em = $this->entityManager;
|
||||
|
||||
if ($this->hydrateTeams) {
|
||||
if ($this->hydrateTeams && \count($projectIds) > 0) {
|
||||
$customerIds = array_filter(array_unique(array_map(function (Project $project) {
|
||||
return $project->getCustomer()->getId();
|
||||
}, $results)), function ($value) { return $value !== null; });
|
||||
@@ -61,13 +62,15 @@ final class ProjectLoader implements LoaderInterface
|
||||
->getQuery()
|
||||
->execute();
|
||||
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL customer.{id}', 'teams')
|
||||
->from(Customer::class, 'customer')
|
||||
->leftJoin('customer.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('customer.id', $customerIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
if (\count($customerIds) > 0) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL customer.{id}', 'teams')
|
||||
->from(Customer::class, 'customer')
|
||||
->leftJoin('customer.teams', 'teams')
|
||||
->andWhere($qb->expr()->in('customer.id', $customerIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
// do not load team members or leads by default, because they will only be used on detail pages
|
||||
|
||||
@@ -45,24 +45,26 @@ final class TeamLoader implements LoaderInterface
|
||||
$em = $this->entityManager;
|
||||
|
||||
// required wherever users are shown, e.g. on "Custom details" page
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL team.{id}', 'members', 'user')
|
||||
->from(Team::class, 'team')
|
||||
->leftJoin('team.members', 'members')
|
||||
->leftJoin('members.user', 'user')
|
||||
->andWhere($qb->expr()->in('team.id', $teamIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
if (\count($teamIds) > 0) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL team.{id}', 'members', 'user')
|
||||
->from(Team::class, 'team')
|
||||
->leftJoin('team.members', 'members')
|
||||
->leftJoin('members.user', 'user')
|
||||
->andWhere($qb->expr()->in('team.id', $teamIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
|
||||
// used in UserTeamProjects widget
|
||||
$qb = $em->createQueryBuilder();
|
||||
/** @var array<Team> $teams */
|
||||
$teams = $qb->select('PARTIAL team.{id}', 'projects')
|
||||
->from(Team::class, 'team')
|
||||
->leftJoin('team.projects', 'projects')
|
||||
->andWhere($qb->expr()->in('team.id', $teamIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
// used in UserTeamProjects widget
|
||||
$qb = $em->createQueryBuilder();
|
||||
/** @var array<Team> $teams */
|
||||
$teams = $qb->select('PARTIAL team.{id}', 'projects')
|
||||
->from(Team::class, 'team')
|
||||
->leftJoin('team.projects', 'projects')
|
||||
->andWhere($qb->expr()->in('team.id', $teamIds))
|
||||
->getQuery()
|
||||
->execute();
|
||||
}
|
||||
|
||||
$projectIds = [];
|
||||
foreach ($results as $team) {
|
||||
@@ -71,7 +73,7 @@ final class TeamLoader implements LoaderInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->loadCustomer) {
|
||||
if ($this->loadCustomer && \count($projectIds) > 0) {
|
||||
// used in UserTeamProjects widget
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('PARTIAL project.{id}', 'customer')
|
||||
|
||||
Reference in New Issue
Block a user