Пример #1
0
 /**
  * process
  *
  * @param ResponseParameterBag $responseParameters
  * @param bool $getEntity
  *
  * @return ResponseParameterBag
  */
 public function process(ResponseParameterBag $responseParameters = null, $getEntity = false)
 {
     if ($responseParameters === null) {
         $responseParameters = new ResponseParameterBag();
         $responseParameters->setRequest($this->requestParameters);
     }
     $offset = $this->requestParameters->getOffset();
     $length = $this->requestParameters->getDisplayLength();
     if ($length > 0) {
         $data = array_slice($this->data, $offset, $length);
     } else {
         $data = array_slice($this->data, $offset);
     }
     $responseParameters->setData($data);
     $responseParameters->setTotal(count($this->data));
     $responseParameters->setDisplayTotal(count($data));
     return $responseParameters;
 }
 /**
  * process
  *
  * @param ResponseParameterBag $responseParameters
  * @param bool                 $getEntity
  *
  * @return ResponseParameterBag
  */
 public function process(ResponseParameterBag $responseParameters = null, $getEntity = false)
 {
     if ($responseParameters === null) {
         $responseParameters = new ResponseParameterBag();
         $responseParameters->setRequest($this->requestParameters);
     }
     $qb = $this->buildQuery();
     $aliases = $qb->getRootAliases();
     $alias = $aliases[0];
     if ($getEntity) {
         $responseParameters->setData($qb->getQuery()->getResult());
     } else {
         $responseParameters->setData($qb->getQuery()->getArrayResult());
     }
     $displayTotal = $this->getTotalRecords(clone $this->queryBuilder, $alias);
     $total = $this->getTotalRecords(clone $qb, $alias);
     $responseParameters->setTotal($total);
     $responseParameters->setDisplayTotal($displayTotal);
     return $responseParameters;
 }