HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Repository/FiveYearLecturerPlanRepository.php
<?php

namespace App\Repository;

use App\Entity\FiveYearLecturerPlan;
use App\Entity\LecturerAgreement;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @extends ServiceEntityRepository<FiveYearLecturerPlan>
 *
 * @method FiveYearLecturerPlan|null find($id, $lockMode = null, $lockVersion = null)
 * @method FiveYearLecturerPlan|null findOneBy(array $criteria, array $orderBy = null)
 * @method FiveYearLecturerPlan[]    findAll()
 * @method FiveYearLecturerPlan[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class FiveYearLecturerPlanRepository extends EntityRepository
{
    public function findByIndex(LecturerAgreement $lecturerAgreement): array
    {
        $return = [];
        $results = $this->findBy([
            'lecturerAgreement' => $lecturerAgreement,
        ]);

        foreach ($results as $result) {
            $return[$result->getActivitiesGroupLecturerPositionActivity()->getId()] = $result;
        }

        return $return;
    }

    public function findFiveYearActivityPlans()
    {
        return $this->createQueryBuilder('f')
            ->join('f.lecturerAgreement', 'la')
            ->join('la.lecturer', 'l')
        ;
    }
}