X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/04441c5bddb7e62cf60aacbaf4146361d7907670..5ec45cd7fa8b353f4f211c0abfcc0c875a938c7e:/Entity/Location.php?ds=inline diff --git a/Entity/Location.php b/Entity/Location.php index 85283df..d70bddf 100644 --- a/Entity/Location.php +++ b/Entity/Location.php @@ -1,16 +1,17 @@ + * (c) Raphaël Gertz * - * for the full copyright and license information, please view the license + * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Rapsys\AirBundle\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Event\PreUpdateEventArgs; @@ -19,88 +20,49 @@ use Doctrine\ORM\Event\PreUpdateEventArgs; */ class Location { /** - * @var integer + * Primary key */ - private $id; + private ?int $id = null; /** * @var string */ - private $title; + private ?string $description = null; /** - * @var string - */ - protected $description; - - /** - * @var string - */ - private $address; - - /** - * @var string - */ - private $zipcode; - - /** - * @var string + * Create datetime */ - private $city; + private \DateTime $created; /** - * @var string + * Update datetime */ - private $latitude; + private \DateTime $updated; /** - * @var string + * Sessions collection */ - private $longitude; + private Collection $sessions; /** - * @var bool + * Snippets collection */ - private $indoor; + private Collection $snippets; /** - * @var bool + * Users collection */ - private $hotspot; - - /** - * @var \DateTime - */ - private $created; - - /** - * @var \DateTime - */ - private $updated; - - /** - * @var ArrayCollection - */ - private $sessions; - - /** - * @var ArrayCollection - */ - private $snippets; - - /** - * @var ArrayCollection - */ - private $users; + private Collection $users; /** * Constructor */ - public function __construct() { + public function __construct(private string $title = '', private string $address = '', private string $zipcode = '0', private string $city = '', private string $latitude = '0', private string $longitude = '0', private bool $hotspot = false, private bool $indoor = false) { //Set defaults - $this->description = null; $this->created = new \DateTime('now'); $this->updated = new \DateTime('now'); + + //Set collections $this->sessions = new ArrayCollection(); $this->snippets = new ArrayCollection(); $this->users = new ArrayCollection(); @@ -111,7 +73,7 @@ class Location { * * @return integer */ - public function getId(): int { + public function getId(): ?int { return $this->id; }