Rename Mappable stuff to Geocode stuff, change dir structure

This commit is contained in:
brabli
2024-08-05 14:25:03 +01:00
parent a6c8c4cc0c
commit 8b662ebfa3
4 changed files with 20 additions and 21 deletions

View File

@@ -0,0 +1,56 @@
<?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;
}
/**
* Returns true if both latitude and longitude have been set
*
* @return bool
*/
public function isGeocoded(): bool
{
return null !== $this->getLatitude() && null !== $this->getLongitude();
}
}