DateTime持续到一个DB列,而不是Symfony 4.4应用程序中的另一个DB列
我有一个令人困惑的问题,其中我有一个 datetime
对象,它似乎可以持久地并冲入一列,但不是另一列。
我已经检查了数据库,数据未写入“保护台”列。
$lifecycle->setRemovalDate($extendedProtectionDate); // this line works
$lifecycle->setProtectionDate($extendedProtectionDate); // this line doesn't
$em = $this->doctrine->getManager();
$em->persist($lifecycle);
$em->flush();
这些字段的定义是相同的:
/**
* @var DateTime
*
* @ORM\Column(name="removalDate", type="date", nullable=true)
*/
private $removalDate;
/**
* @var DateTime
*
* @ORM\Column(name="protectionDate", type="date", nullable=true)
*/
private $protectionDate;
辅助和突变器也是如此:
/**
* @param DateTime|null $removalDate
*
* @return Lifecycle
*/
public function setRemovalDate($removalDate = null) : self
{
$this->removalDate = $removalDate;
return $this;
}
/**
* @return DateTime|null
*/
public function getRemovalDate() : ?DateTime
{
return $this->removalDate;
}
/**
* @param DateTime|null $protectionDate
*
* @return Lifecycle
*/
public function setProtectionDate($protectionDate = null) : self
{
$this->protectionDate = $protectionDate;
return $this;
}
/**
* @return DateTime|null
*/
public function getProtectionDate() : ?DateTime
{
return $this->protectionDate;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论