コード例 #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());
 }