P
P
Prudkovski2014-11-17 19:36:20
symfony
Prudkovski, 2014-11-17 19:36:20

How to specify a parameter from app/config/config.yml in the service parameters?

Good afternoon.
There is a service for which you need to specify parameters. And there is a great desire that this parameter can be edited in app/config/config.yml
This works well:

//src/Bundle/Resources/config/services.yml
parameters:
    visicom_key: fffeeeccccddddd
    visicom_limit: 10

services:
        search_street:
            class: SearchStreetClass
            arguments: [%visicom_key%, %visicom_limit%]

But I want the access key to be available in the config.yml of the application, it seems to me that it is better to keep such settings at the level of the application config, and already include them from the config in the service settings.
But when you try to create parameters in config.yml, it swears at visicom_key namespace not found.
How to link these configs correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-11-17
Protko @Fesor

Your bundle has a directory called DependencyInjection. All the magic happens there. It is there that the rules for parsing the rules for the bundle are set, and it is there that the parameters from config.yml can be put into the container and used in your services.
symfony.com/doc/current/cookbook/configuration/usi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question