Esempio n. 1
0
 /**
  * @param integer $id
  * @return mixed
  */
 public function get($id = null)
 {
     if ($id !== null) {
         if ($this->crudManager instanceof CrudManagerInterface) {
             return $this->crudManager->get($id);
         } else {
             $query = $this->source->createQueryBuilder('entity');
             return $query->andWhere('entity.id = :id')->setParameter('id', $id)->getQuery()->getOneOrNullResult();
         }
     }
     return null;
 }
Esempio n. 2
0
 /**
  * @param int $id
  * @return mixed
  */
 public function get(int $id = null)
 {
     if ($id !== null) {
         if ($this->crudManager instanceof CrudManagerInterface) {
             return $this->crudManager->get($id);
         } else {
             $this->source->clear();
             return $this->source->findPk(1);
         }
     }
     return null;
 }