mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
36 lines
863 B
PHP
36 lines
863 B
PHP
<?php
|
|
|
|
namespace Chill\AMLI\BudgetBundle\Repository;
|
|
|
|
use Chill\PersonBundle\Entity\Person;
|
|
|
|
/**
|
|
* ResourceRepository
|
|
*
|
|
* This class was generated by the Doctrine ORM. Add your own custom
|
|
* repository methods below.
|
|
*/
|
|
class ResourceRepository extends \Doctrine\ORM\EntityRepository
|
|
{
|
|
public function findByPersonAndDate(Person $person, \DateTime $date, $sort = null)
|
|
{
|
|
$qb = $this->createQueryBuilder('c');
|
|
|
|
$qb->where('c.person = :person')
|
|
->andWhere('c.startDate < :date')
|
|
->andWhere('c.startDate < :date OR c.startDate IS NULL')
|
|
;
|
|
|
|
if ($sort !== null) {
|
|
$qb->orderBy($sort);
|
|
}
|
|
|
|
$qb->setParameters([
|
|
'person' => $person,
|
|
'date' => $date
|
|
]);
|
|
|
|
return $qb->getQuery()->getResult();
|
|
}
|
|
}
|