doctrine / doctrine/DoctrineMongoDBBundle

Bundle doesn't support port configuration by environment variable

Open
#466 17 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
384
Forks
228
PR merge metrics
No merged PRs in 30d

Description

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

```yaml
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.