Jump to:

1160 Posts in 2621 Topics by 409 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » SilverStripe 3.0.2-rc2 Update - Routes

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1
Go to End
Author Topic: 868 Views
  • xini
    Avatar
    Community Member
    8 Posts

    SilverStripe 3.0.2-rc2 Update - Routes Link to this post

    I have just upgraded my project to 3.0.2-rc2 and i am running into problems with the definition of a custom route.

    I would like to insert a route before the modelascontrollerroutes but it always gives me either a 404 or the following error, whatever I try:

    Fatal error: Based on their before & after rules two fragments both need to be before/after each other in {path}\framework\core\manifest\ConfigManifest.php on line 293

    I followed the description on http://doc.silverstripe.org/framework/en/3.0/reference/director (with modifications for the changes in 3.0.2-rc2), but that doesn't work. here my code of the routes.yml file:

    ---
    Name: shareroutes
    After: '#coreroutes'
    ---
    Director:
    rules:
    '': 'RootURLController'
    '$URLSegment//$Action/$ID/$OtherID': 'ShortlinkController'

    How do I insert a custom route that should be triggered after #coreroutes and before #modelascontrollerroutes?

    Thanks.

  • hfried
    Avatar
    Administrator
    7 Posts

    Re: SilverStripe 3.0.2-rc2 Update - Routes Link to this post

    After discussing with Xini on IRC, the solution is this:

    share/_config/routes.yml

    ---
    Name: modelascontrollerroutes
    After: cms/routes#modelascontrollerroutes
    ---
    Director: .....
    ---

    This issue is that, in order for every module to not explicitly have to state "After: framework, cms", the framework and cms modules have a "Before: *" statement. This makes it impossible to insert config fragments in-between fragments from cms and framework.

    The work around we're using here is that framework/_config/routes.yml purposely lists only the fragment identifier in the before & after rules, not the module name. This means that by providing another fragment with the same identifier but in a different module we can insert that fragment in the same place as the original.

    868 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.