eZ Community » Forums » Developer » Generate an absolute siteaccess aware...
expandshrink

Generate an absolute siteaccess aware URL

Generate an absolute siteaccess aware URL

Wednesday 02 December 2015 5:15:21 pm - 4 replies

Hi there,

I'm into a REST API controller (eZ\Publish\Core\REST\Server\Controller) right now and I need to share the absolute URL of a location that I get from a search.

I have the BO URI (with the reverseLookup method from the URLAlias Service) but I would like to display the generated siteaccess aware one.

What can I do from here?

Thanks.

Wednesday 02 December 2015 5:53:01 pm

After some trial and error, here goes a working example:

Some elements might be irrelevant, but I don't think so.

The whole request, request stack and setting the siteaccess part on the router won't not be necessary in a web context afaict.

Wednesday 02 December 2015 6:27:24 pm

Thank you so much for your help Bertrand. I get the back office url but not the front one.

Wednesday 02 December 2015 6:35:11 pm

Even if you set the siteaccess on the RouteReference ?

Wednesday 02 December 2015 6:57:52 pm

Yes, even if I set this:

$routeReference->set('siteaccess', 'myfront');

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from