I am creating Twig extensions so I can create custom filters and functions. I need to access a globally configured parameter in the ‘parameters.ini’ file.
How would I go about that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can pass them via dependency injection. Either pass the parameters via the constructor or use setter methods. This example uses xml for service definitions:
Notice how the parameter is confined in percentage symbols. You can read more about dependency injection from the official book.