*/
private $title;
+ /**
+ * @var string
+ */
+ protected $description;
+
/**
* @var string
*/
private $longitude;
/**
- * @var boolean
+ * @var bool
+ */
+ private $indoor;
+
+ /**
+ * @var bool
*/
private $hotspot;
* Constructor
*/
public function __construct() {
+ //Set defaults
+ $this->description = null;
+ $this->created = new \DateTime('now');
+ $this->updated = new \DateTime('now');
$this->sessions = new ArrayCollection();
$this->snippets = new ArrayCollection();
$this->users = new ArrayCollection();
return $this->title;
}
+ /**
+ * Set description
+ *
+ * @param string $description
+ *
+ * @return Location
+ */
+ public function setDescription(?string $description): Location {
+ $this->description = $description;
+
+ return $this;
+ }
+
+ /**
+ * Get description
+ *
+ * @return string
+ */
+ public function getDescription(): ?string {
+ return $this->description;
+ }
+
/**
* Set address
*
return $this->longitude;
}
+ /**
+ * Set indoor
+ *
+ * @param bool $indoor
+ *
+ * @return Session
+ */
+ public function setIndoor(bool $indoor): Location {
+ $this->indoor = $indoor;
+
+ return $this;
+ }
+
+ /**
+ * Get indoor
+ *
+ * @return bool
+ */
+ public function getIndoor(): bool {
+ return $this->indoor;
+ }
+
/**
* Set hotspot
*
- * @param boolean $hotspot
+ * @param bool $hotspot
*
* @return Session
*/
/**
* Get hotspot
*
- * @return boolean
+ * @return bool
*/
public function getHotspot(): bool {
return $this->hotspot;
* Remove session
*
* @param Session $session
- * @return boolean
+ * @return bool
*/
public function removeSession(Session $session): bool {
return $this->sessions->removeElement($session);
* Remove snippet
*
* @param Snippet $snippet
- * @return boolean
+ * @return bool
*/
public function removeSnippet(Snippet $snippet): bool {
return $this->snippets->removeElement($snippet);
* @return Location
*/
public function addUser(User $user): Location {
+ //Add from owning side
+ $user->addLocation($this);
+
$this->users[] = $user;
return $this;
* Remove user
*
* @param User $user
- * @return boolean
+ * @return bool
*/
public function removeUser(User $user): bool {
+ if (!$this->locations->contains($user)) {
+ return true;
+ }
+
+ //Remove from owning side
+ $user->removeLocation($this);
+
return $this->users->removeElement($user);
}