]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Entity/Civility.php
Update composer deps
[userbundle] / Entity / Civility.php
index f3509194542f2ac3711badf984c9d172b5c61c59..4d2671a1dee821fd8e44bd25fa1288dd52f24e64 100644 (file)
@@ -12,6 +12,7 @@
 namespace Rapsys\UserBundle\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
 namespace Rapsys\UserBundle\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\ORM\Event\PreUpdateEventArgs;
 
 use Rapsys\UserBundle\Entity\User;
 
 
 use Rapsys\UserBundle\Entity\User;
 
@@ -160,6 +161,17 @@ class Civility {
                return $this->users;
        }
 
                return $this->users;
        }
 
+       /**
+        * {@inheritdoc}
+        */
+       public function preUpdate(PreUpdateEventArgs $eventArgs) {
+               //Check that we have a civility instance
+               if (($user = $eventArgs->getEntity()) instanceof Civility) {
+                       //Set updated value
+                       $user->setUpdated(new \DateTime('now'));
+               }
+       }
+
        /**
         * Returns a string representation of the title
         *
        /**
         * Returns a string representation of the title
         *