We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When you use view annotation then whatever you return in your controller will be considered as data to the view template, so when using this code:
try { $newPage = $this->container->get('acme_blog.page.handler')->post( $request->request->all() ); $routeOptions = array( 'id' => $newPage->getId(), '_format' => $request->get('_format') ); return $this->routeRedirectView('api_1_get_page', $routeOptions, Codes::HTTP_CREATED); } catch (InvalidFormException $exception) { return $exception->getForm(); }
the view handler will use the view returned by routeRedirectView as the templateData of the annotation view instead of displaying it.
So to prevent this from happening the @view should be removed, but then the function should always return a view like this :
try { $newPage = $this->container->get('acme_blog.page.handler')->post( $request->request->all() ); $routeOptions = array( 'id' => $newPage->getId(), '_format' => $request->get('_format') ); return $this->routeRedirectView('api_1_get_page', $routeOptions, Codes::HTTP_CREATED); } catch (InvalidFormException $exception) { return $this->view($exception->getForm(), Codes::HTTP_BAD_REQUEST) ->setTemplate('AcmeBlogBundle:Page:newPage.html.twig'); }
and it should be working as expected.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When you use view annotation then whatever you return in your controller will be considered as data to the view template, so when using this code:
the view handler will use the view returned by routeRedirectView as the templateData of the annotation view instead of displaying it.
So to prevent this from happening the @view should be removed, but then the function should always return a view like this :
and it should be working as expected.
The text was updated successfully, but these errors were encountered: