Your Entitiy:
class Order { ...
Your listener:
class OrderListener { protected $needsFlush = false; protected $fields = false; public function preUpdate($entity, LifecycleEventArgs $eventArgs) { if (!$this->isCorrectObject($entity)) { return null; } return $this->setFields($entity, $eventArgs); } public function postUpdate($entity, LifecycleEventArgs $eventArgs) { if (!$this->isCorrectObject($entity)) { return null; } foreach ($this->fields as $field => $detail) { echo $field. ' was ' . $detail[0] . ' and is now ' . $detail[1];
source share