コード例 #1
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     if ($this->usersRepository->getAuthenticated()->getRole() == "admin") {
         return $this->ordersRepository->findAll();
     }
     return $this->ordersRepository->findByUser($this->usersRepository->getAuthenticated()->getId());
 }
コード例 #2
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     $usuarioLogado = $this->getUsuarioLogado();
     if ($usuarioLogado->getRole() === 'salesman') {
         $params['user_id'] = $usuarioLogado->getId();
     }
     return $this->repository->findAll($params);
 }
コード例 #3
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     $userRepository = $this->repository->getUsersRepository();
     $user = $userRepository->findByUsername($this->getIdentity()->getRoleId());
     //if ($user->getRole() == "salesman"){
     //return $this->repository->findAllIdUsuario($user->getId());
     //}
     return $this->repository->findAll();
 }
コード例 #4
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     $user = $this->usersRepository->findByUsername($this->getIdentity()->getRoleId());
     return $this->repository->findAll($user);
 }
コード例 #5
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     return $this->repository->findAll();
 }