Search code examples
symfonyroutessymfony-cmf

Unrecognized config option "url_generator"


I'm currently working on an application involving the dynamic router. To customise the url generator I followed the documentation found here. Unfortunately it doesn't work, the following exception occurs:

InvalidConfigurationException in ArrayNode.php line 312:

Unrecognized option "url_generator" under "cmf_routing.dynamic"

This is the relevant part of my config.yml:

# CMF Routing Configuration
cmf_routing:
    cmf_routing:
        routers_by_id:
            router.default: 200
            cmf_routing.dynamic_router: 100
    dynamic:
        enabled: true
        route_provider_service_id: collab.routing.route_provider
        url_generator: collab.routing.url_generator

and for reference, this is the part of services.yml:

collab.routing.route_provider:
    class: CollaborationBundle\Routing\RouteProvider
    arguments:
        - "@annotation_reader"
        - "@doctrine.orm.entity_manager"
        - "@module.provider"
collab.routing.url_generator:
    class: CollaborationBundle\Routing\UrlGenerator

What is the right way to use a custom url generator?


Solution

  • This feature is only available in version 1.4 of RoutingBundle, which is not yet released. You can already start to use it with

    symfony-cmf/routing-bundle: 1.4.*@dev

    The release should happen in the next days, and we don't expect many changes for 1.4 anymore, so this should be pretty safe.