Created
November 20, 2015 13:12
-
-
Save reficedev/f50f0ddd481a11ed98b1 to your computer and use it in GitHub Desktop.
A way to get the current url in a symfony2 controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function newsDetailAction($slug) | |
{ | |
$request = $this->getRequest(); | |
$currentRoute = $request->attributes->get('_route'); | |
$currentUrl = $this->get('router')->generate($currentRoute, array('slug' => $slug), true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment