Symfony 3 passing object through redirects
The parameters you pass will be ignored since the route "success" does not take any arguments. Additionally I don't think you can pass objects. You could serialize it e.g. as a json string and then deserialize it.
I think the best choice for your approach would be to use a Session to save the data (make sure the object is serializable):
$this->container->get('session')->set('task', $task);return $this->redirectToRoute('success');
and then retrieve it in your success action:
public function successAction(Request $request) { $task = $this->container->get('session')->get('task'); if ($task === null || !$task instanceof Task) { return $this->createNotFoundException(); } // Do something}
Also see: https://symfony.com/doc/current/components/http_foundation/sessions.html#main