Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Pass Request to another Controller

Go to End



Community Member, 17 Posts

5 September 2012 at 5:55am

Is it possible to pass the whole Request to another Controller from within a Controller action?

Lets say we have something like this:

The First Controller:

class Controller1 extends Page_Controller {
  public static $url_handlers = array(
    '$Action/$ID'  => 'doStuff'

  function doStuff($request) {
    if($request->param['Action'] == 'special') {
       // Pass control to my SpecialController
    return $this;

The Special Controller

class SpecialController extends Page_Controller {
  public static $url_handlers = array('$ID' => 'display');

  public function display($request) {
     return $this;

How can I do something like this? I've tried it with

return new SpecialController();
$controller = new SpecialController();
return $controller->handleRequest($request);

But all I get is:

[User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack

Any solutions for this?