How can I get current URI from Symfony 1.4?

Ek Kosmos picture Ek Kosmos · May 23, 2011 · Viewed 25.7k times · Source

I am new to symfony.

How can I get from Symfony 1.4 the URI path ?

I have tryied like that:

sfContext::getInstance()->getRequest()->getRelativeUrlRoot()

but is not working.

Answer

Damien picture Damien · Jun 28, 2011

getCurrentInternalUri is, like his name tell, the internal URL, to be used in internal routing functions such as link_to.

The question is about the current URI and even if the previous answer is marked as accepted, here is the method to fetch the current URI in symfony 1.4.

$context->getRequest()->getUri();

In an action :

public function executeDelete(sfWebRequest $request)
{
  $uri = $request->getUri();
}