Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Matching different controller for each HTTP method #196

@damienflament

Description

@damienflament

I want to match a different controller action for each HTTP method on a single URI.
The nicest way to do this might be:

App\Document\Page:
    uri_schema: /{title}
    definitions:
        view:
            methods: [GET]
            defaults:
                _controller: App:Page:view
        edit:
            methods: [PATCH]
            defaults:
                _controller: App:Page:edit
    token_poviders:
        title: [content_method, {method: getTitle}]

As the uri_schema key is validated by the YmlFileLoader but not handled as a mapping key, I tried this:

 App\Document\Page:
    definitions:
        view:
            uri_schema: /{title}
            methods: [GET]
            defaults:
                _controller: App:Page:view
        edit:
            uri_schema: /{title}
            methods: [PATCH]
            defaults:
                _controller: App:Page:edit
    token_poviders:
        title: [content_method, {method: getTitle}]

But the methods key is not handled.

What's the good way to add HTTP method requirements like with the standard Symfony router ?

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