How to concatenate a parameter value with a constant string in Yaml
21,444
Solution 1
You don't need a concatenation character, you can append the constant directly after the parameter. For example, for a service definition in services.yml:
my.service:
class: "%my.service.class%"
arguments:
- "@logger",
- "%some_parameter%",
- "%parameter_url%?wsdl",
Solution 2
If you are looking to concatenate two parameters. You can do it this way:
parameters.yml
parameter_url: XXXXX
parameter_type: ?wsdl
services.yml
my.service:
class: %my.service.class%
arguments:
- @logger,
- %some_parameter%,
- '%parameter_url%%parameter_type%',
Author by
Esteban Filardi
Updated on July 09, 2022Comments
-
Esteban Filardi almost 2 years
I have an URL defined as a parameter in
parameters.yml
. I want to create a service which is a SOAP client. The argument of the SOAP client is an URL for awsdl
file. In my case, the URL of thewsdl
file is"%parameter_url%"
+ "?wsdl"`.Is there a way to concatenate the "?wsdl" to a parameter already defined in YAML?