]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Snippet.php
Add user edit forms
[airbundle] / Entity / Snippet.php
index 20a19401ffc2549f396be30f50e11fb54c483631..f8ae7d28fa4d4e124f7e71235101a2a793baf426 100644 (file)
@@ -319,4 +319,15 @@ class Snippet {
        public function getUser() {
                return $this->user;
        }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs  $eventArgs) {
+               //Check that we have an snippet instance
+               if (($snippet = $eventArgs->getEntity()) instanceof Snippet) {
+                       //Set updated value
+                       $snippet->setUpdated(new \DateTime('now'));
+               }
+       }
 }