/**
* @var string
*/
- protected $title;
+ protected $name;
+
+ /**
+ * @var string
+ */
+ protected $type;
/**
* @var \DateTime
/**
* 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 title
+ * Set name
+ *
+ * @param string $name
+ *
+ * @return Dance
+ */
+ public function setName(string $name): Dance {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ /**
+ * Get name
*
- * @param string $title
+ * @return string
+ */
+ public function getName(): string {
+ return $this->name;
+ }
+
+ /**
+ * Set type
+ *
+ * @param string $type
*
* @return Dance
*/
- public function setTitle(string $title): Dance {
- $this->title = $title;
+ public function setType(string $type): Dance {
+ $this->type = $type;
return $this;
}
/**
- * Get title
+ * Get type
*
* @return string
*/
- public function getTitle(): string {
- return $this->title;
+ public function getType(): string {
+ return $this->type;
}
/**
* @return Dance
*/
public function addUser(User $user): Dance {
+ //Add from owning side
+ $user->addSubscriber($this);
+
$this->users[] = $user;
return $this;
* @return bool
*/
public function removeUser(User $user): bool {
+ //Remove from owning side
+ $user->removeSubscriber($this);
+
return $this->users->removeElement($user);
}
* @return string
*/
public function __toString(): string {
- return $this->title;
+ return $this->name.' '.lcfirst($this->type);
}
}