You can access the "routing" in your controller. In fact, it has a shortcut:
So in your action:
$url = $this->generateUrl('your_route_name', array());
Great for symfony MVC :)
To use this in a flash, you can do the following:
$this->getUser()->setFlash('success_raw', 'Click <a href="'.$url.'">here</a>');
Then render as follows:
echo $sf_user->getFlash('success_raw', ESC_RAW);
This last part displays any HTML objects in the output, so always make sure the data is safe. If it contains any user input, you must make sure that you filter it.
source share