How to change parameters set in parameters.yml in imported parameters.php in Symfony

I have a database password I’d like to dynamically retrieve and have PHP code to retrieve that.

Currently my parameters.yml.dist looks like

    database_user: bob
    database_password: ~
    - { resource: 'parameters.php' }

Parameters.php looks like

    $container->setParameter('database_password', functionCall());

But this does not update the value. I noticed that if I print the database_user variable using getParameter then I get a FileLoaderException of You have requested a non-existent parameter 'database_password'.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *