Symfony2 stop Composer setting .yml.dist parameters to parameters.yml

New in symfony 2.3, the composer install script also copies the contents of the parameters.yml.dist file to the parameters.yml file, explained later here .

My question is: how can I stop a composer performing this action?

+43
parameters symfony composer-php
Jul 03 '13 at 15:10
source share
4 answers

Remove this line twice from composer.json :

 "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 

This is executed by the IncenteevParameterHandler library, which contains a script that does this. By removing the script from the configuration, it will never be called.

If you delete this line permanently, you can also delete these lines (since the library is no longer needed):

 "incenteev/composer-parameter-handler": "~2.0", ... "incenteev-parameters": { "file": "app/config/parameters.yml" }, 
+70
Jul 03 '13 at 15:17
source share
โ€” -

First solution : add "keep-outdated": true in the "extra" section of your composer.json.

 [...] "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", "incenteev-parameters": { "file": "app/config/parameters.yml", "keep-outdated": true <------------ ADDED LINE ------------ }, "branch-alias": { "dev-master": "2.3-dev" }, "symfony-assets-install": "symlink" } [...] 

stimeev will no longer delete parameters.

Second solution : modify the file app / config / parameter.yml.dist. For me, it was adding the Sqlite parameters โ€œpathโ€ and โ€œmemoryโ€ and to avoid deleting them every time the composer was updated.

 # app/config/parameter.yml.dist parameters: database_driver: pdo_sqlite database_host: ~ database_port: ~ database_name: ~ database_user: ~ database_password: ~ database_path: ~ <------------ ADDED LINE ------------ database_memory: ~ <------------ ADDED LINE ------------ [...] 

I donโ€™t know which solution is better, but both work.

+55
Oct 01 '13 at 21:53
source share

leaving an empty array of parameters:

 "incenteev-parameters": { "file": "app/config/parameters.yml" }, 

in an extra section of your composer.json file should work.

 "incenteev-parameters": {}, 
+4
Jul 03 '13 at 15:20
source share

This is the right solution, in my opinion:

 "incenteev-parameters": { "file": "app/config/parameters.yml", "keep-outdated": true }, 

This github release mentioned https://github.com/symfony/symfony-standard/issues/642 as well as the github documentation for stimulus options https://github.com/Incenteev/ParameterHandler

+1
Nov 23 '16 at 10:54 on
source share



All Articles