Symfony 2 YAML throughput arrays

I wonder where I can get more information about special syntax like @somevar or %somevar% in symfony2 yaml configuration?

For example, using @ defines a service call, so we pass dependencies to services. %somevar% , on the other hand, refers to the value of an already specified parameter named somevar .

So if yes:

 parameters: custom: "some value" another: %custom% 

then another will be filled with the custom value, which in my case is "some value". My question is where are these documents documented?

My special need is to be able to reference an array element, something like %somevar[somekey]% , but this syntax does not work.

Thanks in advance!

EDIT: I found this: Full merge key support. Full support for references, aliases, and full merge key. Don't repeat yourself by referencing common configuration bits. Full merge key support. Full support for references, aliases, and full merge key. Don't repeat yourself by referencing common configuration bits.

in yaml docs but does not contain any documentation about it.

+8
php yaml symfony configuration
source share
1 answer

What you are looking for is not really about Yaml itself, but about the Dependency injection container loader Yaml.

If you are looking for documents about this, here are those for the old component (v1): http://components.symfony-project.org/dependency-injection/trunk/book/05-Service-Description

Symfony2 comes with a new component (based on the same principles). You can find the white papers here: http://symfony.com/doc/current/book/service_container.html#service-parameters

As for your problem, you cannot access the DI parameter keys, you must smooth them manually.

You can use the DI extension to suit your needs, take an example in some packages, for example: https://github.com/symfony/AsseticBundle/blob/master/DependencyInjection/AsseticExtension.php#L54 (maybe not a good example) .

0
source share

All Articles