src/Entity/Establishment.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  4. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  5. use App\Repository\EstablishmentRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  11. use Symfony\Component\Uid\Uuid;
  12. /**
  13.  * @ORM\Entity(repositoryClass=EstablishmentRepository::class)
  14.  * @ORM\Table(name="establishment", indexes={
  15.  *  @ORM\Index(name="name", columns={"name"}),
  16.  *  @ORM\Index(name="reference", columns={"reference"}),
  17.  *  @ORM\Index(name="postcode", columns={"postcode"}),
  18.  *  @ORM\Index(name="email", columns={"email"}),
  19.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  20.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  21.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  22.  * })
  23.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  24.  */
  25. class Establishment
  26. {
  27.     use UserTimestampableEntity;
  28.     use UserSoftDeleteableEntity;
  29.     /**
  30.      * @ORM\Id
  31.      * @ORM\Column(type="uuid")
  32.      * @ORM\GeneratedValue(strategy="CUSTOM")
  33.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  34.      */
  35.     private ?Uuid $id null;
  36.     /**
  37.      * @ORM\Column(type="string", length=128)
  38.      */
  39.     private string $name;
  40.     /**
  41.      * @ORM\Column(type="string", length=128, nullable=true)
  42.      */
  43.     private ?string $reference null;
  44.     /**
  45.      * @ORM\Column(type="string", length=128, nullable=true)
  46.      */
  47.     private ?string $address null;
  48.     /**
  49.      * @ORM\Column(type="string", length=128, nullable=true)
  50.      */
  51.     private ?string $address2 null;
  52.     /**
  53.      * @ORM\Column(type="string", length=32, nullable=true)
  54.      */
  55.     private ?string $postcode null;
  56.     /**
  57.      * @ORM\Column(type="string", length=128, nullable=true)
  58.      */
  59.     private ?string $city null;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="establishments")
  62.      */
  63.     private Country $country;
  64.     /**
  65.      * @ORM\Column(type="string", length=32, nullable=true)
  66.      */
  67.     private ?string $phone null;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private ?string $email null;
  72.     /**
  73.      * @ORM\ManyToOne(targetEntity=Context::class, inversedBy="establishments")
  74.      * @ORM\JoinColumn(nullable=false)
  75.      */
  76.     private Context $context;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=UsersEstablishments::class, mappedBy="establishment")
  79.      */
  80.     private Collection $usersEstablishments;
  81.     public function __construct()
  82.     {
  83.         $this->usersEstablishments = new ArrayCollection();
  84.     }
  85.     public function getId(): ?Uuid
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getName(): ?string
  90.     {
  91.         return $this->name;
  92.     }
  93.     public function setName(string $name): self
  94.     {
  95.         $this->name $name;
  96.         return $this;
  97.     }
  98.     public function getReference(): ?string
  99.     {
  100.         return $this->reference;
  101.     }
  102.     public function setReference(?string $reference): self
  103.     {
  104.         $this->reference $reference;
  105.         return $this;
  106.     }
  107.     public function getAddress(): ?string
  108.     {
  109.         return $this->address;
  110.     }
  111.     public function setAddress(?string $address): self
  112.     {
  113.         $this->address $address;
  114.         return $this;
  115.     }
  116.     public function getAddress2(): ?string
  117.     {
  118.         return $this->address2;
  119.     }
  120.     public function setAddress2(?string $address2): self
  121.     {
  122.         $this->address2 $address2;
  123.         return $this;
  124.     }
  125.     public function getPostcode(): ?string
  126.     {
  127.         return $this->postcode;
  128.     }
  129.     public function setPostcode(?string $postcode): self
  130.     {
  131.         $this->postcode $postcode;
  132.         return $this;
  133.     }
  134.     public function getCity(): ?string
  135.     {
  136.         return $this->city;
  137.     }
  138.     public function setCity(?string $city): self
  139.     {
  140.         $this->city $city;
  141.         return $this;
  142.     }
  143.     public function getCountry(): ?Country
  144.     {
  145.         return $this->country;
  146.     }
  147.     public function setCountry(?Country $country): self
  148.     {
  149.         $this->country $country;
  150.         return $this;
  151.     }
  152.     public function getPhone(): ?string
  153.     {
  154.         return $this->phone;
  155.     }
  156.     public function setPhone(?string $phone): self
  157.     {
  158.         $this->phone $phone;
  159.         return $this;
  160.     }
  161.     public function getEmail(): ?string
  162.     {
  163.         return $this->email;
  164.     }
  165.     public function setEmail(?string $email): self
  166.     {
  167.         $this->email $email;
  168.         return $this;
  169.     }
  170.     public function getContext(): ?Context
  171.     {
  172.         return $this->context;
  173.     }
  174.     public function setContext(?Context $context): self
  175.     {
  176.         $this->context $context;
  177.         return $this;
  178.     }
  179.     /**
  180.      * @return Collection<int, UsersEstablishments>
  181.      */
  182.     public function getUsersEstablishments(): Collection
  183.     {
  184.         return $this->usersEstablishments;
  185.     }
  186.     public function addUsersEstablishment(UsersEstablishments $usersEstablishment): self
  187.     {
  188.         if (!$this->usersEstablishments->contains($usersEstablishment)) {
  189.             $this->usersEstablishments[] = $usersEstablishment;
  190.             $usersEstablishment->setEstablishment($this);
  191.         }
  192.         return $this;
  193.     }
  194.     public function removeUsersEstablishment(UsersEstablishments $usersEstablishment): self
  195.     {
  196.         if ($this->usersEstablishments->removeElement($usersEstablishment)) {
  197.             // set the owning side to null (unless already changed)
  198.             if ($usersEstablishment->getEstablishment() === $this) {
  199.                 $usersEstablishment->setEstablishment(null);
  200.             }
  201.         }
  202.         return $this;
  203.     }
  204. }