1 <?php 
declare(strict_types
=1); 
   4  * This file is part of the Rapsys AirBundle package. 
   6  * (c) Raphaël Gertz <symfony@rapsys.eu> 
   8  * For the full copyright and license information, please view the LICENSE 
   9  * file that was distributed with this source code. 
  12 namespace Rapsys\AirBundle\Entity
; 
  14 use Doctrine\Common\Collections\Collection
; 
  15 use Doctrine\Common\Collections\ArrayCollection
; 
  16 use Doctrine\ORM\Event\PreUpdateEventArgs
; 
  25         private ?int $id = null; 
  35         private ?string $description = null; 
  75         private \DateTime 
$created; 
  80         private \DateTime 
$updated; 
  85         private Collection 
$sessions; 
  90         private Collection 
$snippets; 
  95         private Collection 
$users; 
 100         public function __construct() { 
 102                 $this->created 
= new \
DateTime('now'); 
 103                 $this->updated 
= new \
DateTime('now'); 
 106                 $this->sessions 
= new ArrayCollection(); 
 107                 $this->snippets 
= new ArrayCollection(); 
 108                 $this->users 
= new ArrayCollection(); 
 116         public function getId(): ?int { 
 123          * @param string $title 
 127         public function setTitle(string $title): Location 
{ 
 128                 $this->title 
= $title; 
 138         public function getTitle(): string { 
 145          * @param string $description 
 149         public function setDescription(?string $description): Location 
{ 
 150                 $this->description 
= $description; 
 160         public function getDescription(): ?string { 
 161                 return $this->description
; 
 167          * @param string $address 
 171         public function setAddress(string $address): Location 
{ 
 172                 $this->address 
= $address; 
 182         public function getAddress(): string { 
 183                 return $this->address
; 
 189          * @param string $zipcode 
 193         public function setZipcode(string $zipcode): Location 
{ 
 194                 $this->zipcode 
= $zipcode; 
 204         public function getZipcode(): string { 
 205                 return $this->zipcode
; 
 211          * @param string $city 
 215         public function setCity(string $city): Location 
{ 
 226         public function getCity(): string { 
 233          * @param string $latitude 
 237         public function setLatitude(string $latitude): Location 
{ 
 238                 $this->latitude 
= $latitude; 
 248         public function getLatitude(): string { 
 249                 return $this->latitude
; 
 255          * @param string $longitude 
 259         public function setLongitude(string $longitude): Location 
{ 
 260                 $this->longitude 
= $longitude; 
 270         public function getLongitude(): string { 
 271                 return $this->longitude
; 
 277          * @param bool $indoor 
 281         public function setIndoor(bool $indoor): Location 
{ 
 282                 $this->indoor 
= $indoor; 
 292         public function getIndoor(): bool { 
 293                 return $this->indoor
; 
 299          * @param bool $hotspot 
 303         public function setHotspot(bool $hotspot): Location 
{ 
 304                 $this->hotspot 
= $hotspot; 
 314         public function getHotspot(): bool { 
 315                 return $this->hotspot
; 
 321          * @param \DateTime $created 
 325         public function setCreated(\DateTime 
$created): Location 
{ 
 326                 $this->created 
= $created; 
 336         public function getCreated(): \DateTime 
{ 
 337                 return $this->created
; 
 343          * @param \DateTime $updated 
 347         public function setUpdated(\DateTime 
$updated): Location 
{ 
 348                 $this->updated 
= $updated; 
 358         public function getUpdated(): \DateTime 
{ 
 359                 return $this->updated
; 
 365          * @param Session $session 
 369         public function addSession(Session 
$session): Location 
{ 
 370                 $this->sessions
[] = $session; 
 378          * @param Session $session 
 381         public function removeSession(Session 
$session): bool { 
 382                 return $this->sessions
->removeElement($session); 
 388          * @return ArrayCollection 
 390         public function getSessions(): ArrayCollection 
{ 
 391                 return $this->sessions
; 
 397          * @param Snippet $snippet 
 401         public function addSnippet(Snippet 
$snippet): Location 
{ 
 402                 $this->snippets
[] = $snippet; 
 410          * @param Snippet $snippet 
 413         public function removeSnippet(Snippet 
$snippet): bool { 
 414                 return $this->snippets
->removeElement($snippet); 
 420          * @return ArrayCollection 
 422         public function getSnippets(): ArrayCollection 
{ 
 423                 return $this->snippets
; 
 433         public function addUser(User 
$user): Location 
{ 
 434                 //Add from owning side 
 435                 $user->addLocation($this); 
 437                 $this->users
[] = $user; 
 448         public function removeUser(User 
$user): bool { 
 449                 if (!$this->locations
->contains($user)) { 
 453                 //Remove from owning side 
 454                 $user->removeLocation($this); 
 456                 return $this->users
->removeElement($user); 
 462          * @return ArrayCollection 
 464         public function getUsers(): ArrayCollection 
{ 
 471         public function preUpdate(PreUpdateEventArgs 
$eventArgs) { 
 472                 //Check that we have a location instance 
 473                 if (($location = $eventArgs->getObject()) instanceof Location
) { 
 475                         $location->setUpdated(new \
DateTime('now')); 
 480          * Returns a string representation of the location 
 484         public function __toString(): string {