Add filter to Timesheet admin #3

Add stop action to Timesheet admin
This commit is contained in:
Kevin Papst
2018-01-05 11:28:21 +01:00
parent 43f6a9cced
commit ea030ca199
4 changed files with 57 additions and 13 deletions

View File

@@ -296,9 +296,11 @@ class TimesheetRepository extends EntityRepository
{
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('t', 'a')
$qb->select('t', 'a', 'p', 'c')
->from('TimesheetBundle:Timesheet', 't')
->join('t.activity', 'a')
->join('a.project', 'p')
->join('p.customer', 'c')
->orderBy('t.begin', 'DESC');
if ($query->getUser() !== null) {
@@ -319,9 +321,7 @@ class TimesheetRepository extends EntityRepository
$qb->andWhere('a.project = :project')
->setParameter('project', $query->getProject());
} elseif ($query->getCustomer() !== null) {
$qb->join('a.project', 'p')
->join('p.customer', 'c')
->andWhere('p.customer = :customer')
$qb->andWhere('p.customer = :customer')
->setParameter('customer', $query->getCustomer());
}