This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » Location URL alias from a controller

Location URL alias from a controller

Location URL alias from a controller

Thursday 21 May 2015 11:30:24 am - 2 replies


How could I get the URL alias associated to a location from a controller (equivalent to {{ path( location ) }} in Twig) ?



Modified on Thursday 21 May 2015 11:31:02 am by Hakim Bouras

Thursday 21 May 2015 12:07:45 pm

you can use router service for that. try

$this->get( 'router' )->generate( $location ); 

Thursday 21 May 2015 2:59:30 pm

Thanks Carlos, it was exactly what I needed.

And for whom it may help, you can get the absolute URL this way :

$this->get( 'router' )->generate( $location, [], UrlGeneratorInterface::ABSOLUTE_URL );


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from