<?php
namespace App\Entity;
use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
use App\Repository\EstablishmentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Symfony\Component\Uid\Uuid;
/**
* @ORM\Entity(repositoryClass=EstablishmentRepository::class)
* @ORM\Table(name="establishment", indexes={
* @ORM\Index(name="name", columns={"name"}),
* @ORM\Index(name="reference", columns={"reference"}),
* @ORM\Index(name="postcode", columns={"postcode"}),
* @ORM\Index(name="email", columns={"email"}),
* @ORM\Index(name="deleted_at", columns={"deleted_at"}),
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="updated_at", columns={"updated_at"})
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class Establishment
{
use UserTimestampableEntity;
use UserSoftDeleteableEntity;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\Column(type="string", length=128)
*/
private string $name;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private ?string $reference = null;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private ?string $address = null;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private ?string $address2 = null;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private ?string $postcode = null;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private ?string $city = null;
/**
* @ORM\ManyToOne(targetEntity=Country::class, inversedBy="establishments")
*/
private Country $country;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private ?string $phone = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $email = null;
/**
* @ORM\ManyToOne(targetEntity=Context::class, inversedBy="establishments")
* @ORM\JoinColumn(nullable=false)
*/
private Context $context;
/**
* @ORM\OneToMany(targetEntity=UsersEstablishments::class, mappedBy="establishment")
*/
private Collection $usersEstablishments;
public function __construct()
{
$this->usersEstablishments = new ArrayCollection();
}
public function getId(): ?Uuid
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getAddress2(): ?string
{
return $this->address2;
}
public function setAddress2(?string $address2): self
{
$this->address2 = $address2;
return $this;
}
public function getPostcode(): ?string
{
return $this->postcode;
}
public function setPostcode(?string $postcode): self
{
$this->postcode = $postcode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getContext(): ?Context
{
return $this->context;
}
public function setContext(?Context $context): self
{
$this->context = $context;
return $this;
}
/**
* @return Collection<int, UsersEstablishments>
*/
public function getUsersEstablishments(): Collection
{
return $this->usersEstablishments;
}
public function addUsersEstablishment(UsersEstablishments $usersEstablishment): self
{
if (!$this->usersEstablishments->contains($usersEstablishment)) {
$this->usersEstablishments[] = $usersEstablishment;
$usersEstablishment->setEstablishment($this);
}
return $this;
}
public function removeUsersEstablishment(UsersEstablishments $usersEstablishment): self
{
if ($this->usersEstablishments->removeElement($usersEstablishment)) {
// set the owning side to null (unless already changed)
if ($usersEstablishment->getEstablishment() === $this) {
$usersEstablishment->setEstablishment(null);
}
}
return $this;
}
}