mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-31 20:13:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,11 +18,7 @@ use Chill\MainBundle\Search\AbstractSearch;
|
||||
use Chill\MainBundle\Search\SearchInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Search within Events.
|
||||
@@ -90,7 +86,7 @@ class EventSearch extends AbstractSearch
|
||||
foreach ($search as $item) {
|
||||
$results[] = [
|
||||
'id' => $item->getId(),
|
||||
'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
|
||||
'text' => $item->getDate()->format('d/m/Y, H:i').' → '.
|
||||
// $item->getType()->getName()['fr'] . ': ' . // display the type of event
|
||||
$item->getName(),
|
||||
];
|
||||
@@ -115,7 +111,7 @@ class EventSearch extends AbstractSearch
|
||||
'CHILL_EVENT_SEE'
|
||||
);
|
||||
|
||||
if (count($reachableCenters) === 0) {
|
||||
if (0 === \count($reachableCenters)) {
|
||||
// add a clause to block all events
|
||||
$where = $qb->expr()->isNull('e.center');
|
||||
$qb->andWhere($where);
|
||||
@@ -124,18 +120,18 @@ class EventSearch extends AbstractSearch
|
||||
$orWhere = $qb->expr()->orX();
|
||||
|
||||
foreach ($reachableCenters as $center) {
|
||||
$n = $n + 1;
|
||||
++$n;
|
||||
$circles = $this->authorizationHelper->getReachableScopes(
|
||||
$this->security->getUser(),
|
||||
'CHILL_EVENT_SEE',
|
||||
$center
|
||||
);
|
||||
$where = $qb->expr()->andX(
|
||||
$qb->expr()->eq('e.center', ':center_' . $n),
|
||||
$qb->expr()->in('e.circle', ':circle_' . $n)
|
||||
$qb->expr()->eq('e.center', ':center_'.$n),
|
||||
$qb->expr()->in('e.circle', ':circle_'.$n)
|
||||
);
|
||||
$qb->setParameter('center_' . $n, $center);
|
||||
$qb->setParameter('circle_' . $n, $circles);
|
||||
$qb->setParameter('center_'.$n, $center);
|
||||
$qb->setParameter('circle_'.$n, $circles);
|
||||
$orWhere->add($where);
|
||||
}
|
||||
|
||||
@@ -150,7 +146,7 @@ class EventSearch extends AbstractSearch
|
||||
$name = $terms['name'] ?? $terms['_default'];
|
||||
|
||||
$where = $qb->expr()->like('UNACCENT(LOWER(e.name))', ':name');
|
||||
$qb->setParameter('name', '%' . $name . '%');
|
||||
$qb->setParameter('name', '%'.$name.'%');
|
||||
$qb->andWhere($where);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user