mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
issue641: form select2 list activated socialissues and sort by ordering
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Repository\SocialWork;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class SocialIssueRepository implements ObjectRepository
|
||||
@@ -61,4 +62,21 @@ final class SocialIssueRepository implements ObjectRepository
|
||||
{
|
||||
return SocialIssue::class;
|
||||
}
|
||||
|
||||
public function findIssuesNotDesactivated(): array
|
||||
{
|
||||
return $this->buildQueryWithDesactivatedDateCriteria()->getQuery()->getResult();
|
||||
}
|
||||
|
||||
private function buildQueryWithDesactivatedDateCriteria(): QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('si');
|
||||
|
||||
$qb ->where('si.desactivationDate is null')
|
||||
->orWhere('si.desactivationDate > :now')
|
||||
->orderBy('si.ordering', 'ASC')
|
||||
->setParameter('now', new \DateTime('now'));
|
||||
|
||||
return $qb;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user