我有一个问题。我想知道是否有任何替代方法来生成parameters.yml到parameters.yml.dist没有composer install / update。在作曲家安装/更新期间,分别生成和覆盖文件。但是,我希望不经过作曲家。我想知道是否有任何symfony控制台命令来实现这一目标。有人回答了吗?
答案 0 :(得分:20)
您只需运行composer run-script post-install-cmd
它可能会运行一些其他脚本(在默认的symfony配置中使用缓存,引导程序等)。
如果您想仅构建参数,请在您的composer / scripts部分中创建一个新部分。像这样:
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"build-params": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
]
},
...
然后运行composer run-script build-params