52 lines
1.0 KiB
PHP
52 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pcm\GeocodeBundle\Trait\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* Implementation of {@see Pcm\GeocodeBundle\Interface\Entity\GeocodeInterface}
|
|
*
|
|
* @package Pcm\GeocodeBundle
|
|
*/
|
|
trait GeocodeTrait
|
|
{
|
|
#[ORM\Column(type: 'decimal', precision: 10, scale: 6, nullable: true)]
|
|
private ?float $latitude = null;
|
|
|
|
#[ORM\Column(type: 'decimal', precision: 10, scale: 6, nullable: true)]
|
|
private ?float $longitude = null;
|
|
|
|
public function getLatitude(): ?float
|
|
{
|
|
return $this->latitude;
|
|
}
|
|
|
|
public function getLongitude(): ?float
|
|
{
|
|
return $this->longitude;
|
|
}
|
|
|
|
public function setLatitude(float $lat): self
|
|
{
|
|
$this->latitude = $lat;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setLongitude(float $lon): self
|
|
{
|
|
$this->longitude = $lon;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isGeocoded(): bool
|
|
{
|
|
return null !== $this->getLatitude() && null !== $this->getLongitude();
|
|
}
|
|
}
|
|
|