Files
myep-team/src/Repository/ApplicationRepository.php
T

55 lines
1.8 KiB
PHP

<?php
namespace App\Repository;
use App\Entity\Application;
use App\Entity\Teamer;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Application>
*
* @method Application|null find($id, $lockMode = null, $lockVersion = null)
* @method Application|null findOneBy(array $criteria, array $orderBy = null)
* @method Application[] findAll()
* @method Application[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ApplicationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Application::class);
}
public function getListQuery(): Query
{
$qb = $this->createQueryBuilder('application');
return $qb
->select('application', 'assignment', 'destination', 'job_profile', 'teamer')
->innerJoin('application.assignment', 'assignment')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->innerJoin('application.teamer', 'teamer')
->getQuery()
;
}
public function getPendingForTeamerQuery(Teamer $teamer): Query
{
$qb = $this->createQueryBuilder('application');
return $qb
->select('application', 'assignment', 'destination', 'job_profile')
->innerJoin('application.assignment', 'assignment')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->where($qb->expr()->eq('application.teamer', ':teamer'))
->setParameter('teamer', $teamer)
->getQuery()
;
}
}