File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Repository/StudentCountProgramPlanRepository.php
<?php
namespace App\Repository;
use Doctrine\ORM\EntityRepository;
/**
* StudentCountProgramPlanRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class StudentCountProgramPlanRepository extends EntityRepository
{
public function getAllByHash()
{
$results = $this->getEntityManager()
->createQuery(
"SELECT sp
FROM App:StudentCountProgramPlan sp
ORDER BY sp.dataDate ASC"
)
->getResult();
$return = [];
foreach ($results as $result) {
$studiesProgram = $result->getStudiesProgram()->getShortName();
$course = $result->getCourse();
$return[md5($studiesProgram . "_" . $course)] = $result;
}
return $return;
}
public function getAllByProgramCourseType()
{
$query = $this->createQueryBuilder('spp')
->join('spp.studiesProgram', 'sp')
->join('sp.department', 'd')
->select('spp, sp, d')
->addOrderBy('spp.dataDate', 'ASC')
;
$results = $query->getQuery()->getResult();
$return = [];
/** @var StudentCountProgramPlan $result */
foreach ($results as $result) {
$studiesProgram = $result->getStudiesProgram()->getShortName();
$course = $result->getCourse();
$return[$studiesProgram][$course]['NL'] = $result->getCountStudentNl();
$return[$studiesProgram][$course]['I'] = $result->getCountStudentI();
$return[$studiesProgram][$course]['Part'] = $result->getCountStudentPart();
$return[$studiesProgram][$course]['Listener'] = $result->getCountListener();
}
return $return;
}
public function deleteAll()
{
return $this->getEntityManager()
->createQuery(
"DELETE App:StudentCountProgramPlan t"
)
->execute();
}
}