0

I want to use dynamic routing combined with default controller routing. I have a table "Page" which has a column "url" to which the incoming request url should be checked against. If the url is not found in this table, the default controller routes should be checked.

The ChainRouter should be set in this order:

  1. Try to match the request url to the "url" column in "Page" table. With the data in that table I know which template to use to return the response.
  2. Check the default controller routes

I think I need to create a custom dynamic router implementation the search the Page table, this would be the configuration:

cmf_routing:
    chain:
        routers_by_id:
            cmf_routing.dynamic_router: 20
            router.default: 10

And then use a custom dynamic routing implementation. But how do I do that?

BigJ
  • 1,990
  • 2
  • 29
  • 47

1 Answers1

0

You will need to implement and configure a custom route provider: http://symfony.com/doc/master/cmf/bundles/routing/dynamic_customize.html#using-a-custom-route-provider

  • Thnx! I'm implementing RouteProviderInterface, but how do I implement the method getRouteCollectionForRequest() in it? – BigJ Nov 24 '15 at 18:20
  • This might be a solution for you http://www.tomasvotruba.cz/blog/2016/02/25/modular-routing-in-symfony – Tomas Votruba Feb 27 '16 at 02:59