0

I have got two routes - one is for pausing mail jobs, the other one for listing them.

When I click on "pause" - the pause route:

  1. does it's thing
  2. internally calls the list route with a couple of extra nontrivial parameters and fetches it's render array
  3. returns render array

However, I'd like the browser to report the url of the list-route instead of the pause-route. How can I achieve this?

0

You've already tagged the question with "redirect", so this is what you need to do in step 2+3. Don't return a render array, but a redirect response to the second route providing a couple of extra parameters:

return $this->redirect('second.route', ['route_parameter' => '123'], ['query' => ['foo' => 'bar']]);
  • Then, I see the parameter encoded in the url. I am passing myself array of ids, that's ok, but have you experience with passing parameters which are not url encodable? – informatik-handwerk.de Jul 30 '18 at 7:42
  • You can use a session to store data in the background, but this would be more like for the status of the jobs. The normal workflow is to have an action controller manipulating the list and then redirect to the list controller to show the result and use the route parameters to focus on the jobs that were changed. You can also use query parameters. – 4k4 Jul 30 '18 at 8:04
  • Ok, got it. I guess the full solution is to implement a route which has void functionality, yet "corrects" the displayed url at the end of a task, triggered by some other route.... – informatik-handwerk.de Jul 30 '18 at 8:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.