I have the entity class in symfony like this
/**
* @var datetime $createDate
* @ORM\Column(name="create_date", type="datetime", nullable=false)
*
*/
private $createDate;
/**
* @return datetime
*/
public function getCreateDate(){
return $this->createDate;
}
public function setCreateDate(\DateTime $createDate){
$this->createDate=new \DateTime('today');
return $this;
}
basically i want to set the date to today while saving.
I am using JSON which gets are serilaized object and then i am deserializing it.
but this date object is not in that serilaizer and i want to set it when i persist the entity
This is simple case but i want to do some calculation on date and then save it.