示例#1
0
 /**
  * @param \DateTime $dateTime
  *
  * @return QueryBuilder
  */
 public function findReportsInPeriod(\DateTime $dateTime)
 {
     /*
      * We get a dateTime, find the corresponding semester and semester boundaries
      */
     $reportService = new ReportService();
     $period = $reportService->getPeriod($dateTime);
     $qb = $this->_em->createQueryBuilder();
     $qb->select('r');
     $qb->from("Project\\Entity\\Report\\Report", 'r');
     $qb->join('r.project', 'p');
     $qb->andWhere('r.datePeriod >= ?1');
     $qb->andWhere('r.datePeriod <= ?2');
     $qb->setParameter(1, $period->dateStart);
     $qb->setParameter(2, $period->dateEnd);
     $qb->addOrderBy('r.dateCreated', 'DESC');
     /*
      * Return the queryBuilder because we want to add the restrictive project settings
      */
     return $qb;
 }
示例#2
0
 /**
  * Give the full name of a project - including semester.
  *
  * @return string
  */
 public function parseName()
 {
     /*
      * Grab the period from the service
      */
     $documentService = new ReportService();
     $period = $documentService->getPeriod($this->getDatePeriod())->period;
     return sprintf(_("Progress report in %s semester %s"), $this->getDatePeriod()->format("Y"), $period, $period == 1 ? 'st' : 'nd');
 }