Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. /**
  2. * @param Request $request
  3. * @param int $id
  4. *
  5. * @return mixed
  6. */
  7. public function postBikeStatusAction(Request $request,$id)
  8. {
  9. try {
  10. $status = $this->getHandler()->postStatus($this->getRide($id), $request->request->all());
  11. $routeOptions = [
  12. 'id' => $location->getRide()->getId(),
  13. ];
  14.  
  15. return $this->routeRedirectView('get_users_rides', $routeOptions, Response::HTTP_CREATED);
  16. } catch (InvalidFormException $e) {
  17. return $e->getForm();
  18. }
  19. }
  20.  
  21.  
  22. *********************************************************
  23.  
  24. /**
  25. * @param Status $resource
  26. * @param array $parameters
  27. * @param array $options
  28. *
  29. * @return Status
  30. */
  31. public function postStatus($resource,array $parameters, array $options = [])
  32. {
  33. $this->guardObjectImplementsInterface($resource);
  34. $status = $this->formHandler->handleFinish(
  35. $resource,
  36. $parameters,
  37. Request::METHOD_POST,
  38. $options
  39. );
  40. if ($status->getStatus() === false)
  41. {
  42. $resource->getBike()->setBreakdown(false);
  43. }
  44. $this->repository->save($status);
  45.  
  46. return $status;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement