mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,14 +18,10 @@ use Chill\DocStoreBundle\GenericDoc\Providers\PersonDocumentGenericDocProvider;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
@@ -51,15 +47,14 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
||||
public function buildFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface
|
||||
public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface
|
||||
{
|
||||
$query = $this->buildBaseFetchQueryForPerson($person, $startDate, $endDate, $content);
|
||||
|
||||
return $this->addFetchQueryByPersonACL($query, $person);
|
||||
}
|
||||
|
||||
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface
|
||||
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $period, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface
|
||||
{
|
||||
$personDocMetadata = $this->em->getClassMetadata(PersonDocument::class);
|
||||
$participationMetadata = $this->em->getClassMetadata(AccompanyingPeriodParticipation::class);
|
||||
@@ -118,7 +113,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
return $this->addFilterClauses($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
public function buildBaseFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
public function buildBaseFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery
|
||||
{
|
||||
$personDocMetadata = $this->em->getClassMetadata(PersonDocument::class);
|
||||
|
||||
@@ -138,7 +133,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
return $this->addFilterClauses($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
private function addFilterClauses(FetchQuery $query, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
private function addFilterClauses(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery
|
||||
{
|
||||
$personDocMetadata = $this->em->getClassMetadata(PersonDocument::class);
|
||||
|
||||
@@ -165,10 +160,11 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
$personDocMetadata->getColumnName('title'),
|
||||
$personDocMetadata->getColumnName('description')
|
||||
),
|
||||
['%' . $content . '%', '%' . $content . '%'],
|
||||
['%'.$content.'%', '%'.$content.'%'],
|
||||
[Types::STRING, Types::STRING]
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
@@ -188,7 +184,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
$this->addACL($qb, $person);
|
||||
|
||||
foreach ($orderBy as $field => $order) {
|
||||
$qb->addOrderBy('d.' . $field, $order);
|
||||
$qb->addOrderBy('d.'.$field, $order);
|
||||
}
|
||||
|
||||
$qb->setFirstResult($offset)->setMaxResults($limit);
|
||||
@@ -207,7 +203,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
->getReachableScopes(
|
||||
PersonDocumentVoter::SEE,
|
||||
$center
|
||||
)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -230,7 +226,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
|
||||
foreach ($this->centerResolverManager->resolveCenters($person) as $center) {
|
||||
$reachableScopes = [
|
||||
...$reachableScopes,
|
||||
...$this->authorizationHelperForCurrentUser->getReachableScopes(PersonDocumentVoter::SEE, $center)
|
||||
...$this->authorizationHelperForCurrentUser->getReachableScopes(PersonDocumentVoter::SEE, $center),
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user