コード例 #1
0
ファイル: DataProvider.php プロジェクト: auamarto/crud-bundle
 /**
  * {@inheritdoc}
  */
 public function remove($data, $flush = true)
 {
     $entity = null;
     if (is_object($data)) {
         $entity = $data;
     } elseif (is_numeric($data)) {
         $entity = $this->source->findOneById($data);
     } else {
         throw new \InvalidArgumentException('Argument passed is not an object or it\'s id');
     }
     if ($this->crudManager instanceof CrudManagerInterface) {
         $this->crudManager->remove($entity);
     } else {
         $this->entityManager->remove($entity);
     }
     if ($flush) {
         $this->entityManager->flush();
     }
 }
コード例 #2
0
 /**
  * @param $id
  * @return mixed
  */
 public function getUserById($id)
 {
     return $this->userRepository->findOneById($id);
 }
コード例 #3
0
 public function getOneById($id)
 {
     return parent::findOneById($id);
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function find($id)
 {
     return $this->repository->findOneById($id);
 }