Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DI] Preserve placeholder exception for dynamic arrays #29270

Open
wants to merge 1 commit into
base: master
from

Conversation

@ro0NL
Copy link
Contributor

ro0NL commented Nov 21, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

Here's some initial work to deal with envs for array nodes in config.

From #27683 (comment) this would be a first step.

What's still needed is a way to know about the types, e.g. a env resolving to string should be preserved as array($v) to be really flexible.

cc @stof

@ro0NL

This comment has been minimized.

Copy link
Contributor Author

ro0NL commented Nov 22, 2018

Thinking a bit more about it.. one can only expect env placeholders for string values. Maybe having specialized builder API is the better approach, think;

->ifEnv()
->ifNotEnv()
->ifArrayEnv()
->ifNotArrayEnv() // we need this one for e.g. trusted_hosts instead of isString()
->then()
@mtamazlicaru

This comment has been minimized.

Copy link

mtamazlicaru commented Nov 22, 2018

@ro0NL for me seems ok.

@nicolas-grekas nicolas-grekas added this to the next milestone Nov 22, 2018
@MrMitch

This comment has been minimized.

Copy link
Contributor

MrMitch commented Feb 26, 2019

@stof @ro0NL Hi! Do you need any assitance on this ?
I'm currently facing the exact same issue as mentionned in #28137 (i.e. being able to configure the delivery_addresses of swiftmailer from an env var of varying size between each env).

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
@@ -265,6 +265,21 @@ public function testDiscardedEnvInConfig(): void
$this->assertSame('1', $container->getParameter('boolish'));
}
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
* @expectedExceptionMessage A dynamic value is not compatible with a "Symfony\Component\Config\Definition\PrototypedArrayNode" node type at path "env_extension.nodes".

This comment has been minimized.

Copy link
@nicolas-grekas

nicolas-grekas Nov 5, 2019

Member

should use $this->expectException* now

@nicolas-grekas nicolas-grekas modified the milestones: 4.4, next Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.