cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,11 +1,18 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
@@ -19,6 +26,21 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
}
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
{
return $this->repository->countByAccompanyingPeriod($period);
}
public function countBySocialActionWithDescendants(SocialAction $action): int
{
$qb = $this->buildQueryBySocialActionWithDescendants($action);
$qb->select('COUNT(g)');
return $qb
->getQuery()
->getSingleScalarResult();
}
public function find($id): ?AccompanyingPeriodWork
{
return $this->repository->find($id);
@@ -34,6 +56,18 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
/**
* @param mixed|null $orderBy
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return AccompanyingPeriodWork[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria): ?AccompanyingPeriodWork
{
return $this->repository->findOneBy($criteria);
@@ -44,49 +78,23 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
return AccompanyingPeriodWork::class;
}
/**
*
* @return AccompanyingPeriodWork[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
}
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
{
return $this->repository->countByAccompanyingPeriod($period);
}
public function toDelete()
{
$qb = $this->buildQueryBySocialActionWithDescendants($action);
$qb->select('g');
foreach ($orderBy as $sort => $order) {
$qb->addOrderBy('g.'.$sort, $order);
$qb->addOrderBy('g.' . $sort, $order);
}
return $qb
->setMaxResults($limit)
->setFirstResult($offset)
->getQuery()
->getResult()
;
->getResult();
}
public function countBySocialActionWithDescendants(SocialAction $action): int
{
$qb = $this->buildQueryBySocialActionWithDescendants($action);
$qb->select('COUNT(g)');
return $qb
->getQuery()
->getSingleScalarResult()
;
}
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
private function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
{
$actions = $action->getDescendantsWithThis();
@@ -94,6 +102,7 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
$orx = $qb->expr()->orX();
$i = 0;
foreach ($actions as $action) {
$orx->add(":action_{$i} MEMBER OF g.socialActions");
$qb->setParameter("action_{$i}", $action);