File: /var/www/dvpis2026/dvpis.kaunokolegija.lt/src/Repository/Poll/AnswerRepository.php
<?php
namespace App\Repository\Poll;
use Doctrine\ORM\EntityRepository;
/**
* AnswerRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class AnswerRepository extends EntityRepository
{
public function findByLecturerPage($lecturerId, $page)
{
$results = $this->getEntityManager()
->createQuery(
"SELECT a, af, ar, p, pg
FROM App:Poll\Answer a
JOIN a.answerField af
JOIN a.answerRow ar
JOIN ar.poll p
JOIN p.pollGroup pg
WHERE pg.page = $page and ar.lecturer = $lecturerId
"
)
->getResult();
$return = [];
foreach ($results as $result) {
$return[$result->getAnswerRow()->getId()][$result->getAnswerField()->getId()] = $result->getName();
}
return $return;
}
public function deleteAll()
{
return $this->getEntityManager()
->createQuery(
"DELETE App:Poll\\Answer t"
)
->execute();
}
}