Skip to content

Support per-connection middleware configuration in doctrine.yaml #1897

@ddegasperi

Description

@ddegasperi

Hi,

I'd like to propose a feature for DoctrineBundle that would allow configuring DBAL middlewares per connection directly in the doctrine.yaml configuration file.

This would enable central and consistent management of all connection-related settings in one place — especially useful in applications with multiple DBAL connections.

Currently, middlewares can be configured globally or via attributes/service tags. While this works, supporting configuration at the YAML level per connection would provide a more flexible and declarative approach.

Example:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver: pdo_pgsql
                url: "%env(DATABASE_URL)%"
                middlewares:
                    - App\Doctrine\CustomMiddleware1
            custom:
                driver: pdo_pgsql
                url: "%env(DATABASE_CUSTOM_URL)%"
                middlewares:
                    - App\Doctrine\CustomMiddleware2

Thanks for your great work on the bundle!

Best regards,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions