/** * @inheritDoc */ public function __invoke(array $input) { $return_obj = $this->_validateUserRequest($input); if ($return_obj) { return $return_obj; } if ($this->_user_role != self::ROLE_MANAGER) { return $this->_returnAuthError($this->payload); } $id = $input['id']; $user = new \Equip\Project\DAL\User($id); return $this->payload->withStatus(PayloadInterface::OK)->withOutput($user->toArray()); }
public function __invoke(array $input) { $return_obj = $this->_validateUserRequest($input); if ($return_obj) { return $return_obj; } $id = $input['id']; $user = new \Equip\Project\DAL\User($id); $date = null; /* TODO: get (validated) option query param * for date argument */ return $this->payload->withStatus(PayloadInterface::OK)->withOutput($user->hoursWorked($date)); }
public function __invoke(array $input) { $return_obj = $this->_validateUserRequest($input); if ($return_obj) { return $return_obj; } $id = $input['id']; $user = new \Equip\Project\DAL\User($id); $date = null; /* TODO: get (validated) option query param * for date argument */ $with_mates = false; /* TODO: figure out how to do a decorator to the URL * eg GET /user/id/shifts+workmates */ $with_mates = true; return $this->payload->withStatus(PayloadInterface::OK)->withOutput($user->shifts($date, $with_mates)); }