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() {
91 $this->created
= new \
DateTime('now');
92 $this->updated
= new \
DateTime('now');
93 $this->sessions
= new ArrayCollection();
94 $this->snippets
= new ArrayCollection();
95 $this->users
= new ArrayCollection();
103 public function getId(): int {
110 * @param string $title
114 public function setTitle(string $title): Location
{
115 $this->title
= $title;
125 public function getTitle(): string {
132 * @param string $address
136 public function setAddress(string $address): Location
{
137 $this->address
= $address;
147 public function getAddress(): string {
148 return $this->address
;
154 * @param string $zipcode
158 public function setZipcode(string $zipcode): Location
{
159 $this->zipcode
= $zipcode;
169 public function getZipcode(): string {
170 return $this->zipcode
;
176 * @param string $city
180 public function setCity(string $city): Location
{
191 public function getCity(): string {
198 * @param string $latitude
202 public function setLatitude(string $latitude): Location
{
203 $this->latitude
= $latitude;
213 public function getLatitude(): string {
214 return $this->latitude
;
220 * @param string $longitude
224 public function setLongitude(string $longitude): Location
{
225 $this->longitude
= $longitude;
235 public function getLongitude(): string {
236 return $this->longitude
;
242 * @param boolean $hotspot
246 public function setHotspot(bool $hotspot): Location
{
247 $this->hotspot
= $hotspot;
257 public function getHotspot(): bool {
258 return $this->hotspot
;
264 * @param \DateTime $created
268 public function setCreated(\DateTime
$created): Location
{
269 $this->created
= $created;
279 public function getCreated(): \DateTime
{
280 return $this->created
;
286 * @param \DateTime $updated
290 public function setUpdated(\DateTime
$updated): Location
{
291 $this->updated
= $updated;
301 public function getUpdated(): \DateTime
{
302 return $this->updated
;
308 * @param Session $session
312 public function addSession(Session
$session): Location
{
313 $this->sessions
[] = $session;
321 * @param Session $session
324 public function removeSession(Session
$session): bool {
325 return $this->sessions
->removeElement($session);
331 * @return ArrayCollection
333 public function getSessions(): ArrayCollection
{
334 return $this->sessions
;
340 * @param Snippet $snippet
344 public function addSnippet(Snippet
$snippet): Location
{
345 $this->snippets
[] = $snippet;
353 * @param Snippet $snippet
356 public function removeSnippet(Snippet
$snippet): bool {
357 return $this->snippets
->removeElement($snippet);
363 * @return ArrayCollection
365 public function getSnippets(): ArrayCollection
{
366 return $this->snippets
;
376 public function addUser(User
$user): Location
{
377 $this->users
[] = $user;
388 public function removeUser(User
$user): bool {
389 return $this->users
->removeElement($user);
395 * @return ArrayCollection
397 public function getUsers(): ArrayCollection
{
404 public function preUpdate(PreUpdateEventArgs
$eventArgs) {
405 //Check that we have a location instance
406 if (($location = $eventArgs->getEntity()) instanceof Location
) {
408 $location->setUpdated(new \
DateTime('now'));
413 * Returns a string representation of the location
417 public function __toString(): string {