XF 2.0 Invoke controller/action from an other controller

Jean-Baptiste

Well-known member
Hello,

In my addon, I would like to invoke the controller 'XF\Pub\Controller\Conversation' -> action index.

How can I do that ? (without using the rerouteController method)

Best regardes
 
How can I do that ? (without using the rerouteController method)
Can you elaborate on why rerouteController() doesn't work for your use case? It seems like it would do what you want:
PHP:
return $this->rerouteController('XF:Account', 'index');
 
Can you elaborate on why rerouteController() doesn't work for your use case? It seems like it would do what you want:
PHP:
return $this->rerouteController('XF:Account', 'index');

It doesn't work, because it's redirecting to the URL called in the controller.
As an example, if if reRoute to the conversation index, it will redirect the URL to the /conversation page.
I don't want to do that.
 
That redirect is part of the controller code, so you won't be able to use it in that situation. I don't see why you'd have the exact same output on a different URL though.
 
It doesn't work, because it's redirecting to the URL called in the controller.
As an example, if if reRoute to the conversation index, it will redirect the URL to the /conversation page.
I don't want to do that.
`rerouteController` should work exactly as you want it to work... HOWEVER, if you have an `assertCanonicalUrl` is the rerouted controller, it will redirect to the proper URL after the fact.
 
Back
Top Bottom