我有一个带有日期字段"date_of_birth"(symfony表单日期)的Doctrine模型,由用户填写所有工作100%它按预期保存到db,但是在模型save()方法中我需要检索值保存之前发生此字段.我的问题是,当试图获取日期值时,如果它是新记录则返回空字符串,如果是现有记录则返回旧值
public function save(Doctrine_Connection $conn = null)
{
$dob = $this->getDateOfBirth(); // returns empty str if new and old value if existing
$dob = $this->date_of_birth; //also returns empty str
return parent::save($conn);
}
Run Code Online (Sandbox Code Playgroud)
如何检索此字段的值beore数据已保存