File: /var/www/dvpis2026/dvpis.kaunokolegija.lt/src/Repository/Poll/PollGroupRepository.php
<?php
namespace App\Repository\Poll;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
/**
* PollGroupRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PollGroupRepository extends EntityRepository
{
public function findMaxPage()
{
try {
return $this->getEntityManager()
->createQuery(
"
SELECT MAX(pg.page) as maxPage
FROM App:Poll\PollGroup pg
"
)
->getSingleScalarResult();
} catch (NoResultException $e) {
return null;
} catch (NonUniqueResultException $e) {
return null;
}
}
public function findByPage(int $page)
{
return $this->getEntityManager()
->createQuery("
SELECT
pg, p, af
FROM App:Poll\PollGroup pg
JOIN pg.polls p
JOIN p.answerFields af
WHERE pg.page = $page
")
->getResult()
;
}
}