]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Dance.php
Update translations
[airbundle] / Entity / Dance.php
index fa07ba9693b153c6323fdb92cc15e29b5dbb9e94..dccee339801f6dd00cec7c9a4bfc032bc4a212d5 100644 (file)
@@ -26,7 +26,12 @@ class Dance {
        /**
         * @var string
         */
        /**
         * @var string
         */
-       protected $title;
+       protected $name;
+
+       /**
+        * @var string
+        */
+       protected $type;
 
        /**
         * @var \DateTime
 
        /**
         * @var \DateTime
@@ -50,8 +55,18 @@ class Dance {
 
        /**
         * Constructor
 
        /**
         * Constructor
+        *
+        * @param string $name The dance name
+        * @param string $type The dance type
         */
         */
-       public function __construct() {
+       public function __construct(string $name, string $type) {
+               //Set defaults
+               $this->name = $name;
+               $this->type = $type;
+               $this->created = new \DateTime('now');
+               $this->updated = new \DateTime('now');
+
+               //Set collections
                $this->applications = new ArrayCollection();
                $this->users = new ArrayCollection();
        }
                $this->applications = new ArrayCollection();
                $this->users = new ArrayCollection();
        }
@@ -66,25 +81,47 @@ class Dance {
        }
 
        /**
        }
 
        /**
-        * Set title
+        * Set name
+        *
+        * @param string $name
+        *
+        * @return Dance
+        */
+       public function setName(string $name): Dance {
+               $this->name = $name;
+
+               return $this;
+       }
+
+       /**
+        * Get name
+        *
+        * @return string
+        */
+       public function getName(): string {
+               return $this->name;
+       }
+
+       /**
+        * Set type
         *
         *
-        * @param string $title
+        * @param string $type
         *
         * @return Dance
         */
         *
         * @return Dance
         */
-       public function setTitle(string $title): Dance {
-               $this->title = $title;
+       public function setType(string $type): Dance {
+               $this->type = $type;
 
                return $this;
        }
 
        /**
 
                return $this;
        }
 
        /**
-        * Get title
+        * Get type
         *
         * @return string
         */
         *
         * @return string
         */
-       public function getTitle(): string {
-               return $this->title;
+       public function getType(): string {
+               return $this->type;
        }
 
        /**
        }
 
        /**
@@ -201,7 +238,7 @@ class Dance {
         * {@inheritdoc}
         */
        public function preUpdate(PreUpdateEventArgs $eventArgs) {
         * {@inheritdoc}
         */
        public function preUpdate(PreUpdateEventArgs $eventArgs) {
-               //Check that we have an session instance
+               //Check that we have a dance instance
                if (($dance = $eventArgs->getEntity()) instanceof Dance) {
                        //Set updated value
                        $dance->setUpdated(new \DateTime('now'));
                if (($dance = $eventArgs->getEntity()) instanceof Dance) {
                        //Set updated value
                        $dance->setUpdated(new \DateTime('now'));
@@ -214,6 +251,6 @@ class Dance {
         * @return string
         */
        public function __toString(): string {
         * @return string
         */
        public function __toString(): string {
-               return $this->title;
+               return $this->name.' '.lcfirst($this->type);
        }
 }
        }
 }