Skip to content

[Routing] 'host' routes using 'requirements' does not pass through mandatory parameters #7538

Closed
@FunTimeCoding

Description

@FunTimeCoding

So I have this in my app/config/routing.yml:
acme_store_dev:
resource: "@AcmeStoreBundle/Resources/config/routing.yml"
host: acme.{tld}
requirements:
tld: dev|org

and something like this in the bundles routing.yml:
acme_store_homepage:
pattern: /hello/{name}
defaults: { _controller: AcmeStoreBundle:Default:index }
acme_store_product:
resource: "@AcmeStoreBundle/Resources/config/routing/product.yml"
prefix: /product

and the product.yml contains several auto generated routes like that:
product_show:
pattern: /{id}/show
defaults: { _controller: "AcmeStoreBundle:Product:show" }

The problem is within the first configuration. If I only use one host and no tld matching (and any other form of regex matching in hosts) itll lead to this kind of error:

An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("tld") to generate a URL for route "category_new".") in AcmeStoreBundle:Category:index.html.twig at line 36.

I could now start rewriting all that the crud generator made for me or stop using that form of host matching, but Id really like to use those two features - any suggestions? is this a bug that can be fixed? from what I understand the /prefix is supposed to map route extensions dynamically, and independent of any prior routes, which is also quite nifty to have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions