Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. /**
  2. * @Rest\Put("/{id}", requirements={"id": "\d+"})
  3. * @Rest\View(serializerGroups={"Default", "jakas_Grupa"})
  4. *
  5. * @SWG\Parameter(name="post", in="body", @Model(type=JakasEncjaTYpe::class))
  6. * @SWG\Response(
  7. * response=200,
  8. * description="Returns details of updated entity",
  9. * @Model(type=JakasEncjaTYpe::class, groups={"Default", "jakas_Grupa"})
  10. * )
  11. * @SWG\Response(
  12. * response=422,
  13. * description="Returns validation errors.",
  14. * )
  15. *
  16. * @param EntityManagerInterface $em
  17. * @param FormFactoryInterface $formFactory
  18. * @param Request $request
  19. * @param JakasEncja $jakasEncja
  20. *
  21. * @return View|FormInterface
  22. */
  23. ppublic function put(EntityManagerInterface $em, FormFactoryInterface $formFactory, Request $request, JakasEncja $jakasEncja)
  24. {
  25. $form = $formFactory->create(JakasEncjaType::class, $jakasEncja);
  26.  
  27. if ($form->submit($request->request->all())->isSubmitted()) {
  28. if (!$form->isValid()) {
  29. return $form;
  30. }
  31. $em->persist($jakasEncja);
  32. $em->flush();
  33. }
  34.  
  35.  
  36. return View::create($jakasEncja, Response::HTTP_OK);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement