]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Snippet.php
Cleanup
[airbundle] / Entity / Snippet.php
index 28c7c1cdc0e6912d2b6243eddd0710da5dd6d87f..fa5fe996fbcc68d74fc4ccf6d7dec693aaeef29a 100644 (file)
@@ -96,6 +96,7 @@ class Snippet {
         * Constructor
         */
        public function __construct() {
         * Constructor
         */
        public function __construct() {
+               //Set defaults
                $this->description = null;
                $this->class = null;
                $this->short = null;
                $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->donate = null;
                $this->link = null;
                $this->profile = null;
+               $this->location = null;
+               $this->created = new \DateTime('now');
+               $this->updated = new \DateTime('now');
        }
 
        /**
        }
 
        /**
@@ -207,11 +211,11 @@ class Snippet {
        /**
         * Set rate
         *
        /**
         * Set rate
         *
-        * @param string $rate
+        * @param int $rate
         *
         * @return Snippet
         */
         *
         * @return Snippet
         */
-       public function setRate(?string $rate): Snippet {
+       public function setRate(?int $rate): Snippet {
                $this->rate = $rate;
 
                return $this;
                $this->rate = $rate;
 
                return $this;
@@ -220,9 +224,9 @@ class Snippet {
        /**
         * Get rate
         *
        /**
         * Get rate
         *
-        * @return string
+        * @return int
         */
         */
-       public function getRate(): ?string {
+       public function getRate(): ?int {
                return $this->rate;
        }
 
                return $this->rate;
        }
 
@@ -233,7 +237,7 @@ class Snippet {
         *
         * @return User
         */
         *
         * @return User
         */
-       public function setHat(bool $hat): Snippet {
+       public function setHat(?bool $hat): Snippet {
                $this->hat = $hat;
 
                return $this;
                $this->hat = $hat;
 
                return $this;
@@ -244,7 +248,7 @@ class Snippet {
         *
         * @return bool
         */
         *
         * @return bool
         */
-       public function getHat(): bool {
+       public function getHat(): ?bool {
                return $this->hat;
        }
        /**
                return $this->hat;
        }
        /**
@@ -426,9 +430,9 @@ class Snippet {
        /**
         * {@inheritdoc}
         */
        /**
         * {@inheritdoc}
         */
-       public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs  $eventArgs) {
+       public function preUpdate(PreUpdateEventArgs $eventArgs) {
                //Check that we have an snippet instance
                //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'));
                }
                        //Set updated value
                        $snippet->setUpdated(new \DateTime('now'));
                }