- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的parameters.yml中有一些自定义条目,每次我运行composer更新时,它都会添加缺少的条目,这更糟糕的是会覆盖我的自定义条目。我怎样才能阻止这个?
例如 Composer 更新之前
#parameters.yml
# Env = GLOBAL
parameters:
# DB settings - GLOBAL
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
#mailer settings
mailer_to: yo@yo.com
mailer_from: yo@site.com
mailer_transport: smtp
mailer_subject: ":-| Something is broken!"
# Framework use - GLOBAL
locale: en
之后
#parameters.yml
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
mailer_transport: smtp
locale: en
database_name:
database_user:
database_password:
mailer_host:
mailer_user:
mailer_password:
secret:
幸运的是,我的存储库和 ide 中的工作文件是两个不同的文件,需要同步。在我运行 Composer Update 后,当我运行同步时,我会将所有文件下载到我的 IDE,除了parameters.yml,我将其推回以覆盖刚刚自动创建的文件。
我想消除这个麻烦,因为我将数据库密码保存在 per/env 文件中。
编辑:当我尝试通过将不需要的变量清零来将其填充为虚拟值时,它也会适得其反。
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
Updating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_name: null
database_user: null
database_password: null
mailer_host: null
mailer_user: null
mailer_password: null
secret: null
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "mailer_from".
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
自定义参数本身也会引起问题。
现在我去看看我新生成的文件,它看起来像这样
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
mailer_transport: smtp
locale: en
database_name: null
database_user: null
database_password: null
mailer_host: null
mailer_user: null
mailer_password: null
secret: null
但是在理想情况下我需要它说的是这个
/**
* my custom comment and copyright/legal tamper warning
*/
# Env = GLOBAL
parameters:
# DB settings - GLOBAL
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
#mailer settings
mail_to: me@site.com
mail_from: site@site.com
mail_transport: smtp
mail_subject: ":-| Something is broken!"
# Framework use - GLOBAL
locale: en
我的其余参数位于另一个参数文件中,该文件根据 env 加载的内容动态包含,并且每个参数都有不同的数据库信用。
编辑 根据 @AlpineCoder 回答:我的最新发现为什么添加虚拟值不起作用
当我将其添加到我的parameters.yml时
#dummy values to avoid regeneration
database_name: dummyvalue
database_user: dummyvalue
database_password: dummyvalue
mailer_host: dummyvalue
mailer_user: dummyvalue
mailer_password: dummyvalue
secret: dummyvalue
它不再要求我填写这些值,这很好,但是,它仍然重新生成文件,删除我所有的自定义值,只剩下这个
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
mailer_transport: smtp
locale: en
database_name: dummyvalue
database_user: dummyvalue
database_password: dummyvalue
mailer_host: dummyvalue
mailer_user: dummyvalue
mailer_password: dummyvalue
secret: dummyvalue
最佳答案
您有两个选择,要么填写您的parameters.yml.dist,要么您可以转到您的composer.json文件,在post-update-cmd和post-install-cmd中您应该看到类似的内容
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
如果删除该行,当您运行 Composer 时,您的参数将不再更改。
如果您正在与其他人协作,更新您的parameters.yml.dist可能是更好的方法,因为这将有助于提醒他们在引入新参数时需要填写新参数。
关于symfony - 使用自定义值时,composer update 会不断覆盖parameters.yml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28574912/
目前我正在尝试创建一个 Web 部署包。所以我在我的项目的根目录中添加了一个 parameters.xml 并指定了一些自定义参数。 我发现我的很多参数都部分相同。所以我想做某种参数引用。寻找这个,我
如何设置我的 Symfony 2 项目以使用 parameters.yml 而不是 parameters.ini? 在 Controller 中,我可以像这样从 parameters.ini 中获取变
有什么建议说明为什么此 AWS CloudFormation 不断回滚吗? { "Description" : "Single Instance", "Resources" : {
PARAMETERS: p_1 TYPE i, p_2 TYPE i. 因此在初始屏幕中,我看到了 2 个文本框,每个参数一个。 如果我填写其中一个,但不按回车键,然后我在第二个上调用 F4 帮助,我
我需要存储 Parameter由 Build() 返回作为 Parameter (因为我将参数存储在一个数组中,另一种方法就是为每个参数数量复制粘贴相同的类太多,因为 c# 没有可变参数泛型)。 问题
我正在为我的 CS 类(class)做作业,它使用了 const,我对何时使用它们感到有点困惑。 这3个函数有什么区别? int const function(parameters) int fu
在 xgboost 的文档中,我读到: base_score [default=0.5] : the initial prediction score of all instances, global
我正在创建一个新的 REST 服务。 向 REST 服务传递参数的标准是什么。在 Java 的不同 REST 实现中,您可以将参数配置为路径的一部分或请求参数。例如, 路径参数 http://www.
在我的程序中,我需要验证传递给程序的参数是一个整数,所以我创建了这个小函数来处理用户键入“1st”而不是“1”的情况。 问题是它根本不起作用。我尝试调试,我只能告诉你参数是 12,long 是 2。(
谁能告诉我如何使用存储在 &rest 指定值中的参数。 我已经阅读了很多,似乎作者只知道如何列出所有参数。 (defun test (a &rest b) b) 这很高兴看到,但并不是很有用。 到目前
我使用 git 有一段时间了,但大多数时候我更喜欢与 Intelij IDEA 的集成。现在,为了扩展我对系统的知识和理解,我决定更多地使用命令行。我观察到的是有两种类型的参数: --paramete
我正在用 RAML 编写一些 REST 文档,但我被卡住了。 我的问题: - 我有一个用于搜索的 GET 请求,它可以采用参数“id”或( 独占或 )“引用”。拥有 只有其中之一 是必须的。 我知道怎
我定义了一个这样的 Action : /secure/listaAnnunci.action /login.jsp 我可以从 Action 内部访问参数吗?谢谢 最佳答案 您需要实现 S
我有一个 TeamCity 8.0.3 项目,其中包含多个配置,其中有一个通用参数(定义为项目参数):targetServerIP .这些配置之一是“一键部署”,它通过使用快照依赖项启动其他配置。我已
try{ Class.forName("com.mysql.jdbc.Driver"); mycon = DriverManager.getConnec
我在实际的 javascript 项目中遇到了一个非常奇怪的情况。我创建了一个自定义事件并将数组放入该事件 $.publish("merilon/TablesLoaded", getTables())
在使用参数数组进行插入/更新期间,可以忽略一个/一些特定行的一个/一些参数。 我提供了一个简单的例子。想象一下,我们有一个包含 3 列的表:X、Y 和 Z。我们想在 block 中执行更新(如果缺少某
如何编写接受未定义参数的函数?我想它可以像那样工作: void foo(void undefined_param) { if(typeof(undefined_param) == int) {
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章PDO版本问题 Invalid parameter number: no
Jenkins 管道作业如下所示: 部分 Jenkinsfile(我们使用脚本化管道)是: properties([parameters([string(defaultValue: "", descr
我是一名优秀的程序员,十分优秀!