0

I have some parameter values in app/config/parameters.yml

parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: database_name
    ...
    igv: 0.18
    isc: 0.18

Now, I want to use the parameters in a Custom class in AppBundle/CustomClass.php. How can I use this parameters? I try $this->container->get('igv') but not works.

2

1 Answer 1

4

In services.yml:

my_app.customclass:
    class:  AppBundle\CustomClass
    arguments: ['%igv%', '%isc%']

Add the arguments to the constructor of AppBundle\CustomClass.

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. The documentation on use of parameters is here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.