getObject(); $now = $this->clock->now(); $user = $this->security->getUser(); if ($entity instanceof TimestampableInterface) { $entity->setCreatedAt($now); $entity->setUpdatedAt($now); } if ($entity instanceof BlamableInterface && $user instanceof UserInterface) { $entity->setCreatedBy($user); $entity->setUpdatedBy($user); } } public function preUpdate(PreUpdateEventArgs $args): void { $entity = $args->getObject(); $user = $this->security->getUser(); if ($entity instanceof TimestampableInterface) { $entity->setUpdatedAt($this->clock->now()); } if ($entity instanceof BlamableInterface && $user instanceof UserInterface) { $entity->setUpdatedBy($user); } } }