We need to modify the entity as following
/**
* @ORM\HasLifecycleCallbacks
*/
class Distribution
-----------------------------------
/**
* Gets triggered only on insert
* @ORM\PrePersist
*/
public function onPrePersist()
{
$this->created_at = new \DateTime("now");
}
/**
* Gets triggered only on update
* @ORM\PreUpdate
*/
public function onPreUpdate()
{
$this->updated_at = new \DateTime("now");
}