<?php
namespace App\Entity;
use App\Repository\AddressRepository;
use Doctrine\ORM\Mapping as ORM;
use function Sodium\add;
#[ORM\Embeddable]
class Address
{
#[ORM\Column(type: 'string', length: 15, nullable: true)]
private $number;
#[ORM\Column(type: 'string', length: 100, nullable: true)]
private $street;
#[ORM\Column(type: 'string', length: 15, nullable: true)]
private $streetType;
#[ORM\Column(type: 'string', length: 5, nullable: true)]
private $postalCode;
#[ORM\Column(type: 'string', length: 100, nullable: true)]
private $city;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $additional;
#[ORM\Column(type: 'float', nullable: true)]
private $latitude;
#[ORM\Column(type: 'float', nullable: true)]
private $longitude;
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(?string $number): self
{
$this->number = $number;
return $this;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(?string $street): self
{
$this->street = $street;
return $this;
}
public function getStreetType(): ?string
{
return $this->streetType;
}
public function setStreetType(?string $streetType): self
{
$this->streetType = $streetType;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getAdditional(): ?string
{
return $this->additional;
}
public function setAdditional(?string $additional): self
{
$this->additional = $additional;
return $this;
}
public function getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(?float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(?float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getFullAddress(): string
{
$address = '';
if ($number = $this->getNumber()) {
$address .= $number;
}
if ($street = $this->getStreet()) {
$address .= ' '.$street;
}
if ($postalCode = $this->getPostalCode()) {
$address .= ' '.$postalCode;
}
if ($city = $this->getCity()) {
$address .= ' '.$this->city;
}
$address = trim($address);
return $address;
}
public function __toString(): string
{
return $this->getFullAddress();
}
}