/** * 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()); }
/** * 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); }
/** * 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(); }
/** * 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); }
/** * Fetch all or a subset of resources * * @param array $params * @return ApiProblem|mixed */ public function fetchAll($params = array()) { return $this->repository->findAll(); }