]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Snippet.php
Shorten air bundle route aliases
[airbundle] / Entity / Snippet.php
index 4e9d406c2b10572a3e48a29c6e59a0cc1d6a4c5f..fa5fe996fbcc68d74fc4ccf6d7dec693aaeef29a 100644 (file)
@@ -96,6 +96,7 @@ class Snippet {
         * Constructor
         */
        public function __construct() {
+               //Set defaults
                $this->description = null;
                $this->class = null;
                $this->short = null;
@@ -105,6 +106,9 @@ class Snippet {
                $this->donate = null;
                $this->link = null;
                $this->profile = null;
+               $this->location = null;
+               $this->created = new \DateTime('now');
+               $this->updated = new \DateTime('now');
        }
 
        /**
@@ -426,9 +430,9 @@ class Snippet {
        /**
         * {@inheritdoc}
         */
-       public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs  $eventArgs) {
+       public function preUpdate(PreUpdateEventArgs $eventArgs) {
                //Check that we have an snippet instance
-               if (($snippet = $eventArgs->getEntity()) instanceof Snippet) {
+               if (($snippet = $eventArgs->getObject()) instanceof Snippet) {
                        //Set updated value
                        $snippet->setUpdated(new \DateTime('now'));
                }