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,19 +1,26 @@
<?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.
*/
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\ParentRoleHelper;
use Doctrine\ORM\EntityManagerInterface;
class UserACLAwareRepository implements UserACLAwareRepositoryInterface
{
private ParentRoleHelper $parentRoleHelper;
private EntityManagerInterface $em;
private ParentRoleHelper $parentRoleHelper;
public function __construct(ParentRoleHelper $parentRoleHelper, EntityManagerInterface $em)
{
$this->parentRoleHelper = $parentRoleHelper;
@@ -33,30 +40,26 @@ class UserACLAwareRepository implements UserACLAwareRepositoryInterface
->join('u.groupCenters', 'gc')
->join('gc.permissionsGroup', 'pg')
->join('pg.roleScopes', 'rs')
->where($qb->expr()->in('rs.role', $parents))
;
->where($qb->expr()->in('rs.role', $parents));
if ($onlyEnabled) {
$qb->andWhere($qb->expr()->eq('u.enabled', "'TRUE'"));
}
if (NULL !== $center) {
if (null !== $center) {
$centers = $center instanceof Center ? [$center] : $center;
$qb
->andWhere($qb->expr()->in('gc.center', ':centers'))
->setParameter('centers', $centers)
;
->setParameter('centers', $centers);
}
if (NULL !== $scope) {
if (null !== $scope) {
$scopes = $scope instanceof Scope ? [$scope] : $scope;
$qb
->andWhere($qb->expr()->in('rs.scope', ':scopes'))
->setParameter('scopes', $scopes)
;
->setParameter('scopes', $scopes);
}
return $qb->getQuery()->getResult();
}
}