Set repositories for EventBundle on the new way + dependent issues

This commit is contained in:
2023-07-22 23:05:30 +02:00
parent 48cd8aaa9f
commit 4028cc8a8b
13 changed files with 114 additions and 161 deletions

View File

@@ -11,23 +11,28 @@ declare(strict_types=1);
namespace Chill\EventBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Chill\EventBundle\Entity\Participation;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* Class ParticipationRepository.
*/
class ParticipationRepository extends EntityRepository
class ParticipationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Participation::class);
}
/**
* Count number of participations per person.
*
* @param $person_id
*
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @return mixed
*/
public function countByPerson($person_id)
public function countByPerson($person_id): int
{
return $this->createQueryBuilder('p')
->select('COUNT (p.id)')