Refactor point value object and add observability
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SignalRepository;
|
||||
use App\ValueObject\Point;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -23,11 +24,11 @@ class Signal
|
||||
#[ORM\Column(type: Types::STRING, length: 64)]
|
||||
private string $userKey;
|
||||
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
private float $lat;
|
||||
#[ORM\Embedded(class: Point::class, columnPrefix: 'user_')]
|
||||
private Point $userLocation;
|
||||
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
private float $lng;
|
||||
#[ORM\Embedded(class: Point::class, columnPrefix: 'signal_')]
|
||||
private Point $signalLocation;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'created_at')]
|
||||
private DateTimeImmutable $createdAt;
|
||||
@@ -49,26 +50,26 @@ class Signal
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLat(): float
|
||||
public function getUserLocation(): Point
|
||||
{
|
||||
return $this->lat;
|
||||
return $this->userLocation;
|
||||
}
|
||||
|
||||
public function setLat(float $lat): self
|
||||
public function setUserLocation(Point $userLocation): self
|
||||
{
|
||||
$this->lat = $lat;
|
||||
$this->userLocation = $userLocation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLng(): float
|
||||
public function getSignalLocation(): Point
|
||||
{
|
||||
return $this->lng;
|
||||
return $this->signalLocation;
|
||||
}
|
||||
|
||||
public function setLng(float $lng): self
|
||||
public function setSignalLocation(Point $signalLocation): self
|
||||
{
|
||||
$this->lng = $lng;
|
||||
$this->signalLocation = $signalLocation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user