17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1348 Views |
-
Director::addRules() bug?

8 December 2008 at 11:43am Last edited: 8 December 2008 11:45am
I think I may have found a bug in the Director.php code. Correct me if I'm wrong.
If I use Director::addRules() to specify a custom controller for a URL like this:
Director::addRules(50, array ('myurl/$Action/$Class' => 'My_Controller'));
The getControllerForURL() function in the Director class will parse that array and get the name of the controller as a string ("$controller"), and it will instantiate the "My_Controller" object like this:
$controllerObj = new $controller();
However, every descendant of the Controller class expects a "$dataRecord" variable to be passed into it. Silverstripe errors out when I use anything but "Controller " as my custom controller because the __construct() method is missing argument 1.
Am I missing something? Seems crazy!
-
Re: Director::addRules() bug?

9 December 2008 at 6:21am
Hmm.. Never mind. It seems the only accepted custom controller you can use is a subclass of Controller.
| 1348 Views | ||
|
Page:
1
|
Go to Top |
