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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Calling action on custom route handling


Go to End


741 Views

Avatar
Rudiger

Community Member, 8 Posts

16 December 2016 at 7:16pm

I have a custom route in my routes.yml

Director:
  rules:
    '$URLSegment/$Name/$Action/$ID': 'BaseController'

Which is being managed by BaseController:

class BaseController extends ModelAsController {

	// this is called because it extends ModelAsController
	public function getNestedController() {
		$params = $this->getRequest()->params();
		$profile = new ProfileController();
		$profile->profile = $params['URLRequest'];
		return $profile;
	}

}

Now this calls the index of ProfileController but if i had a path like /rudiger/test it still calls index and the action is never followed. I have setup allowed_actions. How can I get the correct action to be called?