/
home
/
obinna
/
html
/
boaz2
/
src
/
Repository
/
Upload File
HOME
<?php namespace App\Repository; use App\Entity\Depot; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; /** * @method Depot|null find($id, $lockMode = null, $lockVersion = null) * @method Depot|null findOneBy(array $criteria, array $orderBy = null) * @method Depot[] findAll() * @method Depot[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class DepotRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Depot::class); } public function findNotCheckedIn() { return $this->getEntityManager() ->createQuery( 'SELECT distinct d.id, d.name from App\Entity\Depot d LEFT JOIN App\Entity\UserDepot ud WITH d = ud.depot WHERE d.id NOT IN (SELECT IDENTITY(u.depot) FROM App\Entity\UserDepot u WHERE u.checkout IS NULL)' ) ->getResult(); } // public function findNotCheckedIn() // { // return $this->createQueryBuilder('d') // // ->andWhere('d.exampleField = :val') // ->leftJoin( // 'App\Entity\UserDepot', // 'ud', // \Doctrine\ORM\Query\Expr\Join::WITH, // 'd = ud.depot' // ) // ->getQuery() // ->getResult() // ; // } // /** // * @return Depot[] Returns an array of Depot objects // */ /* public function findByExampleField($value) { return $this->createQueryBuilder('d') ->andWhere('d.exampleField = :val') ->setParameter('val', $value) ->orderBy('d.id', 'ASC') ->setMaxResults(10) ->getQuery() ->getResult() ; } */ /* public function findOneBySomeField($value): ?Depot { return $this->createQueryBuilder('d') ->andWhere('d.exampleField = :val') ->setParameter('val', $value) ->getQuery() ->getOneOrNullResult() ; } */ }