WIP: WIP
This commit is contained in:
1 parent
8740041e7a
commit
8e3499581a
35 files changed
+119
-1109
No files matched your search
@@ -2,41 +2,41 @@
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\BpnDate;
|
||||
use App\Entity\Destination;
|
||||
use App\Repository\Traits\QueryHelperTrait;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<BpnDate>
|
||||
* @extends ServiceEntityRepository<Destination>
|
||||
*
|
||||
* @method BpnDate|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method BpnDate|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method BpnDate[] findAll()
|
||||
* @method BpnDate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
* @method Destination|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Destination|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Destination[] findAll()
|
||||
* @method Destination[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class BpnDateRepository extends ServiceEntityRepository
|
||||
class DestinationRepository extends ServiceEntityRepository
|
||||
{
|
||||
use QueryHelperTrait;
|
||||
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, BpnDate::class);
|
||||
parent::__construct($registry, Destination::class);
|
||||
}
|
||||
|
||||
public function getAutocompletionData(string $search): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('bpn_date');
|
||||
$qb = $this->createQueryBuilder('destination');
|
||||
|
||||
$dates = $qb
|
||||
->where($qb->expr()->orX(
|
||||
$qb->expr()->like('bpn_date.product', ':product'),
|
||||
$qb->expr()->like('bpn_date.hotel', ':hotel')
|
||||
$qb->expr()->like('destination.product', ':product'),
|
||||
$qb->expr()->like('destination.hotel', ':hotel')
|
||||
))
|
||||
->setParameter('product', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->setParameter('hotel', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->orderBy('bpn_date.dateFrom', 'ASC')
|
||||
->addOrderBy('bpn_date.product', 'ASC')
|
||||
->orderBy('destination.dateFrom', 'ASC')
|
||||
->addOrderBy('destination.product', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\DispositionRequirement;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<DispositionRequirement>
|
||||
*
|
||||
* @method DispositionRequirement|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method DispositionRequirement|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method DispositionRequirement[] findAll()
|
||||
* @method DispositionRequirement[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class DispositionRequirementRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, DispositionRequirement::class);
|
||||
}
|
||||
|
||||
public function save(DispositionRequirement $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(DispositionRequirement $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return DispositionRequirement[] Returns an array of DispositionRequirement objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('d')
|
||||
// ->andWhere('d.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('d.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?DispositionRequirement
|
||||
// {
|
||||
// return $this->createQueryBuilder('d')
|
||||
// ->andWhere('d.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
Reference in new issue
Block a user