]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Application.php
Add air bundle env variables
[airbundle] / Entity / Application.php
index b54b1e2e4cf42a20d5fbab633032d6fd4dc0b3de..4e94f204fe63f289d359f26d84187b9d033a1067 100644 (file)
@@ -22,6 +22,11 @@ class Application {
         */
        private $id;
 
+       /**
+        * @var Dance
+        */
+       private $dance;
+
        /**
         * @var float
         */
@@ -56,6 +61,11 @@ class Application {
         * Constructor
         */
        public function __construct() {
+               //Set defaults
+               $this->score = null;
+               $this->canceled = null;
+               $this->created = new \DateTime('now');
+               $this->updated = new \DateTime('now');
                $this->session = null;
                $this->user = null;
        }
@@ -69,6 +79,28 @@ class Application {
                return $this->id;
        }
 
+       /**
+        * Set dance
+        *
+        * @param Dance $dance
+        *
+        * @return Application
+        */
+       public function setDance(Dance $dance): Application {
+               $this->dance = $dance;
+
+               return $this;
+       }
+
+       /**
+        * Get dance
+        *
+        * @return Dance
+        */
+       public function getDance(): Dance {
+               return $this->dance;
+       }
+
        /**
         * Set score
         *
@@ -206,9 +238,9 @@ class Application {
         */
        public function preUpdate(PreUpdateEventArgs $eventArgs) {
                //Check that we have an application instance
-               if (($user = $eventArgs->getEntity()) instanceof Application) {
+               if (($application = $eventArgs->getObject()) instanceof Application) {
                        //Set updated value
-                       $user->setUpdated(new \DateTime('now'));
+                       $application->setUpdated(new \DateTime('now'));
                }
        }
 }