src/Entity/Address.php line 15
<?phpnamespace App\Entity;use App\Repository\AddressRepository;use App\Trait\DateTrait;use App\Trait\DeletableTrait;use DateTimeImmutable;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Component\Validator\Constraints\NotBlank;#[ORM\Entity(repositoryClass: AddressRepository::class)]class Address{use DateTrait;use DeletableTrait;const TYPE_HOME = 'address.type.home';const TYPE_WORK = 'address.type.work';const TYPE_DELIVERY = 'address.type.delivery';const TYPE_OTHER = 'address.type.other';#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['establishment:view', 'order:list'])]private ?int $id = null;#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $country = null;#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $city = null;#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $commune = null;#[ORM\Column(length: 255, nullable: true)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $district = null;#[ORM\Column(length: 255)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $street = null;#[ORM\Column(length: 10, nullable: true)]#[Groups(['establishment:view', 'establishment:register', 'order:list'])]private ?string $number = null;#[ORM\Column]private ?bool $isDefault = false;#[Assert\NotBlank]#[Assert\NotNull]#[ORM\Column(length: 255)]private ?string $type = "address.type.home";#[ORM\ManyToOne(inversedBy: 'addresses')]private ?Client $client = null;#[ORM\ManyToOne(inversedBy: 'addresses')]private ?Employee $employee = null;public function __construct(){if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();$this->updatedAt = new DateTimeImmutable();}public static function getTypes(): array{return [self::TYPE_HOME,self::TYPE_WORK,self::TYPE_DELIVERY,self::TYPE_OTHER,];}public function getId(): ?int{return $this->id;}public function getCountry(): ?string{return $this->country;}public function setCountry(string $country): self{$this->country = $country;return $this;}public function getCity(): ?string{return $this->city;}public function setCity(string $city): self{$this->city = $city;return $this;}public function getCommune(): ?string{return $this->commune;}public function setCommune(string $commune): self{$this->commune = $commune;return $this;}public function getDistrict(): ?string{return $this->district;}public function setDistrict(?string $district): self{$this->district = $district;return $this;}public function getStreet(): ?string{return $this->street;}public function setStreet(string $street): self{$this->street = $street;return $this;}public function getNumber(): ?string{return $this->number;}public function setNumber(string $number): self{$this->number = $number;return $this;}public function __toString(): string{return "$this->number $this->street, $this->district $this->commune $this->city, $this->country";}public function isIsDefault(): ?bool{return $this->isDefault;}public function setIsDefault(bool $isDefault): static{$this->isDefault = $isDefault;return $this;}public function getType(): ?string{return $this->type;}public function setType(string $type): static{$this->type = $type;return $this;}public function getClient(): ?Client{return $this->client;}public function setClient(?Client $client): static{$this->client = $client;return $this;}public function getEmployee(): ?Employee{return $this->employee;}public function setEmployee(?Employee $employee): static{$this->employee = $employee;return $this;}}