improvements

This commit is contained in:
Kevin Papst
2016-10-30 23:39:55 +01:00
parent 55ac11d517
commit 1678129fe9
47 changed files with 4390 additions and 1746 deletions

View File

@@ -17,6 +17,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta;
use TimesheetBundle\Model\ProjectStatistic;
/**
* Class ProjectRepository
@@ -26,11 +27,27 @@ use Pagerfanta\Pagerfanta;
class ProjectRepository extends EntityRepository
{
/**
* Return statistic data for all user.
*
* @return ProjectStatistic
*/
public function getGlobalStatistics()
{
$countAll = $this->getEntityManager()
->createQuery('SELECT COUNT(p.id) FROM TimesheetBundle:Project p')
->getSingleScalarResult();
$stats = new ProjectStatistic();
$stats->setTotalAmount($countAll);
return $stats;
}
/**
* @param User $user
* @return Query
*/
public function queryLatest(User $user = null)
protected function queryLatest(User $user = null)
{
$qb = $this->getEntityManager()->createQueryBuilder();
@@ -41,7 +58,11 @@ class ProjectRepository extends EntityRepository
return $qb->getQuery();
}
public function queryAll($orderBy = 'id')
/**
* @param string $orderBy
* @return Query
*/
protected function queryAll($orderBy = 'id')
{
$qb = $this->getEntityManager()->createQueryBuilder();