mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
cs fixer
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -44,6 +45,14 @@ final class SocialActionRepository implements ObjectRepository
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialAction[]
|
||||
*/
|
||||
public function findAllActive(): array
|
||||
{
|
||||
return $this->buildQueryWithDesactivatedDateCriteria()->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed|null $limit
|
||||
* @param mixed|null $offset
|
||||
@@ -68,22 +77,14 @@ final class SocialActionRepository implements ObjectRepository
|
||||
return SocialAction::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialAction[]
|
||||
*/
|
||||
public function findAllActive(): array
|
||||
{
|
||||
return $this->buildQueryWithDesactivatedDateCriteria()->getQuery()->getResult();
|
||||
}
|
||||
|
||||
private function buildQueryWithDesactivatedDateCriteria(): QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('sa');
|
||||
|
||||
$qb ->where('sa.desactivationDate is null')
|
||||
|
||||
$qb->where('sa.desactivationDate is null')
|
||||
->orWhere('sa.desactivationDate > :now')
|
||||
->orderBy('sa.ordering', 'ASC')
|
||||
->setParameter('now', new \DateTime('now'));
|
||||
->setParameter('now', new DateTime('now'));
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -39,6 +40,14 @@ final class SocialIssueRepository implements ObjectRepository
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialIssue[]
|
||||
*/
|
||||
public function findAllActive(): array
|
||||
{
|
||||
return $this->buildQueryWithDesactivatedDateCriteria()->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed|null $limit
|
||||
* @param mixed|null $offset
|
||||
@@ -63,22 +72,14 @@ final class SocialIssueRepository implements ObjectRepository
|
||||
return SocialIssue::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialIssue[]
|
||||
*/
|
||||
public function findAllActive(): array
|
||||
{
|
||||
return $this->buildQueryWithDesactivatedDateCriteria()->getQuery()->getResult();
|
||||
}
|
||||
|
||||
private function buildQueryWithDesactivatedDateCriteria(): QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('si');
|
||||
|
||||
$qb ->where('si.desactivationDate is null')
|
||||
$qb->where('si.desactivationDate is null')
|
||||
->orWhere('si.desactivationDate > :now')
|
||||
->orderBy('si.ordering', 'ASC')
|
||||
->setParameter('now', new \DateTime('now'));
|
||||
->setParameter('now', new DateTime('now'));
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
Reference in New Issue
Block a user