I created an entity "Person" in Doctrine2, and I added to it an Adress entity, which is a value object (embeddable).
I want to allow a Person creation, without an Address, so I tag my embedded as "nullable = true". But on the other hand, my Address entity, if it exists, SHOULD contains at least some information (like city, zip code, etc...). So it has "nullable = false" attributes.
Address:
type: embeddable
fields:
[...]
city:
type: string
length: 255
nullable: …
Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 Gitlab CI。当我推送开发分支时,它会运行测试并更新我的测试环境(远程服务器)上的代码。
但是 gitlab runner 已经在使用相同的构建文件夹: builds/a3ac64e9/0/myproject/myproject
但我想每次都创建一个 now 文件夹:
builds/a3ac64e9/1/yproject/myproject
builds/a3ac64e9/2/yproject/myproject
builds/a3ac64e9/3/yproject/myproject
使用它,我可以通过更改指向最后一个运行器目录的符号链接来更新我的网站。
有没有办法以这种方式配置 Gitlab Runner?
我正在尝试序列化包含要插入 Doctrine MySQL 数据库的实体的 XML 文档。
例如,我的实体中有这两个属性:
问题是,而不是像这样进入我的 XML 文档:
<company>
<id>8888</id>
<name>MyCompany</name>
</company>
Run Code Online (Sandbox Code Playgroud)
我得到了这样的东西:
<company id="8888" name="MyCompany"/>
Run Code Online (Sandbox Code Playgroud)
XML 是由我合作的一家独立公司生成的;所以我无法改变它。所以 Symfony2 序列化器正在创建一个空$company
属性 :(
有没有一种简单的方法可以像我想要的那样对序列化过程进行服装化?还是我必须实现一个完整的独立方法?
非常感谢。
我创建了一个函数,该函数根据第一个日期时间创建两个日期时间:
// initial datetime (for test)
$dt = new \Datetime;
$dt->setDate(2012, 9, 5);
// splitting into 2 different datetimes
$dates = $this->defineLimitsByDate($dt);
// $dates[0] = 2011-07-01
// $dates[1] = 2012-09-01
Run Code Online (Sandbox Code Playgroud)
目前,一切都还好。现在,我将这些日期时间传递到另一个函数中,在该函数中,我使用循环while
递增第一个日期,直到到达第二个日期:
// now I use the 2 datetimes into a function...
$dateKeys = $this->generateDateKeys($dates[0], $dates[1]);
// and the function seems to modify them outside itself !
// $dates[0] = 2012-10-01
// $dates[1] = 2012-09-01
Run Code Online (Sandbox Code Playgroud)
看来我的函数内的 while 循环generateDateKeys
没有在本地修改参数。它更改函数外部 $dates 的值。但我从不使用引用传递。
谁能启发我一下吗?
php ×2
symfony ×2
datetime ×1
deployment ×1
doctrine-orm ×1
embeddable ×1
function ×1
gitlab ×1
gitlab-ci ×1
nullable ×1
reference ×1
variables ×1
xml ×1