コード例 #1
0
ファイル: Nda.php プロジェクト: iteaoffice/program
 /**
  * @param Call    $call
  * @param Contact $contact
  *
  * @return null|NdaEntity
  *
  * @throws \Doctrine\ORM\NonUniqueResultException
  */
 public function findNdaByCallAndContact(Call $call, Contact $contact)
 {
     $qb = $this->_em->createQueryBuilder();
     $qb->select('n');
     $qb->from("Program\\Entity\\Nda", 'n');
     $qb->join('n.call', 'call');
     $qb->andWhere($qb->expr()->in('call', [$call->getId()]));
     $qb->andWhere('n.contact = ?2');
     $qb->setParameter(2, $contact);
     $qb->addOrderBy('n.dateCreated', 'DESC');
     $qb->setMaxResults(1);
     return $qb->getQuery()->getOneOrNullResult();
 }
コード例 #2
0
ファイル: CallService.php プロジェクト: debranova/program
 /**
  * @return bool
  */
 public function isEmpty()
 {
     return is_null($this->call) || is_null($this->call->getId());
 }
コード例 #3
0
ファイル: Call.php プロジェクト: iteaoffice/program
 /**
  * @param CallEntity $call
  *
  * @return mixed
  */
 public function findMinAndMaxYearInCall(CallEntity $call)
 {
     $emConfig = $this->getEntityManager()->getConfiguration();
     $emConfig->addCustomDatetimeFunction('YEAR', 'DoctrineExtensions\\Query\\Mysql\\Year');
     $dql = 'SELECT
                     MIN(YEAR(p.dateStartActual)) AS minYear,
                     MAX(YEAR(p.dateEndActual)) AS maxYear
                FROM Project\\Entity\\Project p
                JOIN p.call c
                WHERE c.id = ' . $call->getId();
     $result = $this->_em->createQuery($dql)->getScalarResult();
     return array_shift($result);
 }