phpsword / sword-bundle

Modern WordPress development with Symfony
https://getsword.com
MIT License
125 stars 4 forks source link

Allow security and doctrine overriding #34

Closed williarin closed 1 year ago

williarin commented 1 year ago

This PR brings a new config parameter:

sword:
    # ...
    overridden_configurations:
        - security
        - doctrine

This allows the app to override Sword configuration, which prepends by default security and doctrine.

For example:

doctrine:
    dbal:
        dbname: 'newname'
        host: 'newhost'

This will keep the other defaults but override Sword.

Also, without overriding Doctrine configuration, Sword's default connection is preserved when creating multiple DBAL connections:

doctrine:
    dbal:
        default_connection: default
        connections:
            default: ~ # Sword default connection
            another:
                url: '%env(DATABASE_URL)%'

Or to override the default connection:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                url: '%env(DATABASE_URL)%' # No more Sword default connection
            another:
                url: '%env(DATABASE_URL)%'