mirror of
https://github.com/kevinpapst/kimai2.git
synced 2025-05-12 12:42:00 +00:00
prepare sub-objects for findByIds
This commit is contained in:
parent
891296fb81
commit
c5fe1818cd
5 changed files with 9 additions and 11 deletions
|
@ -72,7 +72,7 @@ class ActivityRepository extends EntityRepository
|
|||
->setParameter('id', $ids)
|
||||
;
|
||||
|
||||
return $this->getActivities($qb->getQuery());
|
||||
return $this->getActivities($this->prepareActivityQuery($qb->getQuery()));
|
||||
}
|
||||
|
||||
public function saveActivity(Activity $activity): void
|
||||
|
|
|
@ -60,7 +60,7 @@ class CustomerRepository extends EntityRepository
|
|||
->setParameter('id', $ids)
|
||||
;
|
||||
|
||||
return $this->getCustomers($qb->getQuery(), new CustomerQuery());
|
||||
return $this->getCustomers($this->prepareCustomerQuery($qb->getQuery()), new CustomerQuery());
|
||||
}
|
||||
|
||||
public function saveCustomer(Customer $customer): void
|
||||
|
|
|
@ -63,7 +63,7 @@ class ProjectRepository extends EntityRepository
|
|||
->setParameter('id', $ids)
|
||||
;
|
||||
|
||||
return $this->getProjects($qb->getQuery());
|
||||
return $this->getProjects($this->prepareProjectQuery($qb->getQuery()));
|
||||
}
|
||||
|
||||
public function saveProject(Project $project): void
|
||||
|
|
|
@ -50,7 +50,7 @@ class TeamRepository extends EntityRepository
|
|||
->setParameter('id', $ids)
|
||||
;
|
||||
|
||||
return $this->getTeams($qb->getQuery());
|
||||
return $this->getTeams($this->prepareTeamQuery($qb->getQuery()));
|
||||
}
|
||||
|
||||
public function saveTeam(Team $team): void
|
||||
|
|
|
@ -76,15 +76,13 @@ class UserRepository extends EntityRepository implements UserLoaderInterface, Us
|
|||
|
||||
public function getUserById(int $id): ?User
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = $this->find($id);
|
||||
$users = $this->findByIds([$id]);
|
||||
|
||||
if ($user !== null) {
|
||||
$loader = new UserLoader($this->getEntityManager(), true);
|
||||
$loader->loadResults([$user]);
|
||||
if (\count($users) === 1) {
|
||||
return $users[0];
|
||||
}
|
||||
|
||||
return $user;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +108,7 @@ class UserRepository extends EntityRepository implements UserLoaderInterface, Us
|
|||
->setParameter('id', $ids)
|
||||
;
|
||||
|
||||
return $this->getUsers($qb->getQuery());
|
||||
return $this->getUsers($this->prepareUserQuery($qb->getQuery()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue