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
Hello,
In our API, we must always initialize the same view context, based on a service.
I must add this in every controller:
$view = $this->view($data, $status); $context = new Context(); $context->setGroups($this->groupsResolver->getGroups()); $view->setContext($context); return $this->handleView($view);
I made a trait to not duplicate code, it works but I feel it can be better.
I thought of adding an event in ViewHandler->handle, a listener can then do the job of setting the view context.
public function handle(View $view, Request $request = null) { if (null === $request) { $request = $this->requestStack->getCurrentRequest(); } + $this->eventDispatcher->dispatch(new HandleViewEvent($view, $request));
What do you think of it?
Thanks!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
In our API, we must always initialize the same view context, based on a service.
I must add this in every controller:
I made a trait to not duplicate code, it works but I feel it can be better.
I thought of adding an event in ViewHandler->handle, a listener can then do the job of setting the view context.
What do you think of it?
Thanks!
The text was updated successfully, but these errors were encountered: