我有一个问题。我想知道是否有其他方法来生成参数。Yml到parameters.yml.dist,无需composer install/update。在编译器安装/更新期间,分别生成和覆盖文件。但我不打算讲作曲家。我想知道是否有任何symfony控制台命令来实现这一点。有人知道答案吗?
您可以直接运行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