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,30 +1,20 @@
<?php
/*
* Copyright (C) 2021 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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\Notification;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ObjectRepository;
final class NotificationRepository implements ObjectRepository
{
@@ -35,16 +25,18 @@ final class NotificationRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(Notification::class);
}
public function countAllForAttendee(User $addressee): int // TODO passer à attendees avec S
{
$query = $this->queryAllForAttendee($addressee, $countQuery = true);
return $query->getSingleScalarResult();
}
public function find($id, $lockMode = null, $lockVersion = null): ?Notification
{
return $this->repository->find($id, $lockMode, $lockVersion);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Notification
{
return $this->repository->findOneBy($criteria, $orderBy);
}
/**
* @return Notification[]
*/
@@ -54,19 +46,54 @@ final class NotificationRepository implements ObjectRepository
}
/**
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return Notification[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findAllForAttendee(User $addressee, $limit = null, $offset = null): array // TODO passer à attendees avec S
{
$query = $this->queryAllForAttendee($addressee);
if ($limit) {
$query = $query->setMaxResults($limit);
}
if ($offset) {
$query = $query->setFirstResult($offset);
}
return $query->getResult();
}
/**
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return Notification[]
*/
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
private function queryAllForAttendee(User $addressee, bool $countQuery=False): Query
public function findOneBy(array $criteria, ?array $orderBy = null): ?Notification
{
return $this->repository->findOneBy($criteria, $orderBy);
}
public function getClassName()
{
return Notification::class;
}
private function queryAllForAttendee(User $addressee, bool $countQuery = false): Query
{
$qb = $this->repository->createQueryBuilder('n');
$select = 'n';
if($countQuery) {
if ($countQuery) {
$select = 'count(n)';
}
@@ -78,37 +105,4 @@ final class NotificationRepository implements ObjectRepository
return $qb->getQuery();
}
/**
* @return int
*/
public function countAllForAttendee(User $addressee): int // TODO passer à attendees avec S
{
$query = $this->queryAllForAttendee($addressee, $countQuery=True);
return $query->getSingleScalarResult();
}
/**
* @return Notification[]
*/
public function findAllForAttendee(User $addressee, $limit = null, $offset = null): array // TODO passer à attendees avec S
{
$query = $this->queryAllForAttendee($addressee);
if($limit) {
$query = $query->setMaxResults($limit);
}
if($offset) {
$query = $query->setFirstResult($offset);
}
return $query->getResult();
}
public function getClassName() {
return Notification::class;
}
}