1 <?php
declare(strict_types
=1);
4 * this file is part of the rapsys packbundle 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\ArrayCollection
;
15 use Doctrine\ORM\Event\PreUpdateEventArgs
;
72 * @var ArrayCollection
77 * @var ArrayCollection
82 * @var ArrayCollection
89 public function __construct() {
90 $this->sessions
= new ArrayCollection();
91 $this->snippets
= new ArrayCollection();
92 $this->users
= new ArrayCollection();
100 public function getId(): int {
107 * @param string $title
111 public function setTitle(string $title): Location
{
112 $this->title
= $title;
122 public function getTitle(): string {
129 * @param string $address
133 public function setAddress(string $address): Location
{
134 $this->address
= $address;
144 public function getAddress(): string {
145 return $this->address
;
151 * @param string $zipcode
155 public function setZipcode(string $zipcode): Location
{
156 $this->zipcode
= $zipcode;
166 public function getZipcode(): string {
167 return $this->zipcode
;
173 * @param string $city
177 public function setCity(string $city): Location
{
188 public function getCity(): string {
195 * @param string $latitude
199 public function setLatitude(string $latitude): Location
{
200 $this->latitude
= $latitude;
210 public function getLatitude(): string {
211 return $this->latitude
;
217 * @param string $longitude
221 public function setLongitude(string $longitude): Location
{
222 $this->longitude
= $longitude;
232 public function getLongitude(): string {
233 return $this->longitude
;
239 * @param boolean $hotspot
243 public function setHotspot(bool $hotspot): Location
{
244 $this->hotspot
= $hotspot;
254 public function getHotspot(): bool {
255 return $this->hotspot
;
261 * @param \DateTime $created
265 public function setCreated(\DateTime
$created): Location
{
266 $this->created
= $created;
276 public function getCreated(): \DateTime
{
277 return $this->created
;
283 * @param \DateTime $updated
287 public function setUpdated(\DateTime
$updated): Location
{
288 $this->updated
= $updated;
298 public function getUpdated(): \DateTime
{
299 return $this->updated
;
305 * @param Session $session
309 public function addSession(Session
$session): Location
{
310 $this->sessions
[] = $session;
318 * @param Session $session
321 public function removeSession(Session
$session): bool {
322 return $this->sessions
->removeElement($session);
328 * @return ArrayCollection
330 public function getSessions(): ArrayCollection
{
331 return $this->sessions
;
337 * @param Snippet $snippet
341 public function addSnippet(Snippet
$snippet): Location
{
342 $this->snippets
[] = $snippet;
350 * @param Snippet $snippet
353 public function removeSnippet(Snippet
$snippet): bool {
354 return $this->snippets
->removeElement($snippet);
360 * @return ArrayCollection
362 public function getSnippets(): ArrayCollection
{
363 return $this->snippets
;
373 public function addUser(User
$user): Location
{
374 $this->users
[] = $user;
385 public function removeUser(User
$user): bool {
386 return $this->users
->removeElement($user);
392 * @return ArrayCollection
394 public function getUsers(): ArrayCollection
{
401 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
402 //Check that we have a location instance
403 if (($location = $eventArgs->getEntity()) instanceof Location
) {
405 $location->setUpdated(new \
DateTime('now'));
410 * Returns a string representation of the location
414 public function __toString(): string {