Symfony2 stop Composer installing parameters.yml.dist into parameters.yml

后端 未结 4 602
有刺的猬
有刺的猬 2020-12-13 08:47

New in symfony 2.3 the composer install script also copies the parameters.yml.dist file contents into the parameters.yml file, explain

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 09:14

    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"
    }
    [...]
    

    incenteev will not remove parameters any more.

    Second solution : modify the app/config/parameter.yml.dist file. For me it was to add Sqlite parameters 'path' and 'memory' and avoid to see them deleted each time I do a composer update.

    # 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 the best but both works.

提交回复
热议问题