Skip to content

Bundle doesn't support port configuration by environment variable #466

Open
@zluiten

Description

@zluiten

When configuring the metadata_cache_driver section to use environment variables for the port configuration

doctrine_mongodb:
    document_managers:
        default:
            metadata_cache_driver:
                type: memcached
                class: Doctrine\Common\Cache\MemcachedCache
                instance_class: Memcached
                host: '%env(DOCTRINE_MONGODB_CACHE_HOST)%'
                port: '%env(int:DOCTRINE_MONGODB_CACHE_PORT)%'

It'll fail building the container with the exception

In IntegerNode.php line 29:

  Invalid type for path "doctrine_mongodb.document_managers.default.metadata_cache_driver.port". Expected int, but got string.

This makes sense because the port configuration should be an integer as it is configured as an IntegerNode. This is therefore not going to work because the placeholder value is being a string.

I would propose to change the port node to be of type ScalarNode, that would also be consistent with the DBAL configuration section which accepts the port to be scalar as well which you can check here: https://github.com/doctrine/DoctrineBundle/blob/master/DependencyInjection/Configuration.php#L192

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions