Sunday, January 30, 2022

[FIXED] Symfony custom parameter fails when using composer

Issue

I am having trouble with symfony parameters. In config_dev.yml I have this line:

swiftmailer:
delivery_address: "%support_email%"

and now I want to add the parameter support_email to the parameters.yml

parameters:
   support_email: test@test.com

Now if I run composer update I get this error:

  [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
  You have requested a non-existent parameter "support_email".

What can I do to handle this error?


Solution

Symfony does read the file parameters.yml.dist then build the parameters.yml, and removes parameters that are not defined in the .dist.

Just add this line in parameters.yml.dist:

parameters:
    [...]
    support_email: you@company.com


Answered By - Paul Andrieux

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.