X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/ff832b7380916c7d63401978ca6b39bd2a35ef39..46718ab1a0cb7878556d18db4dffa306e95110cd:/Entity/User.php?ds=sidebyside

diff --git a/Entity/User.php b/Entity/User.php
index 6d10f33..8fb4105 100644
--- a/Entity/User.php
+++ b/Entity/User.php
@@ -271,7 +271,7 @@ class User implements UserInterface, \Serializable {
 	/**
 	 * Get civility
 	 */
-	public function getCivility(): Civility {
+	public function getCivility(): ?Civility {
 		return $this->civility;
 	}
 
@@ -400,6 +400,17 @@ class User implements UserInterface, \Serializable {
 		return $this->active;
 	}
 
+	/**
+	 * {@inheritdoc}
+	 */
+	public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $eventArgs) {
+		//Check that we have an user instance
+		if (($user = $eventArgs->getEntity()) instanceof User) {
+			//Set updated value
+			$user->setUpdated(new \DateTime('now'));
+		}
+	}
+
 	/**
 	 * Returns a string representation of the user
 	 *