src/Entity/EstablishmentStatus.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EstablishmentStatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=EstablishmentStatusRepository::class)
  9.  * Customer/Fournisseur/Negocient
  10.  */
  11. class EstablishmentStatus
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\OneToMany(targetEntity=Establishments::class, mappedBy="status")
  25.      */
  26.     private $establishments;
  27.     public function __construct()
  28.     {
  29.         $this->establishments = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): self
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     /**
  45.      * @return Collection<int, Establishments>
  46.      */
  47.     public function getEstablishments(): Collection
  48.     {
  49.         return $this->establishments;
  50.     }
  51.     public function addEstablishment(Establishments $establishment): self
  52.     {
  53.         if (!$this->establishments->contains($establishment)) {
  54.             $this->establishments[] = $establishment;
  55.             $establishment->setStatus($this);
  56.         }
  57.         return $this;
  58.     }
  59.     public function removeEstablishment(Establishments $establishment): self
  60.     {
  61.         if ($this->establishments->removeElement($establishment)) {
  62.             // set the owning side to null (unless already changed)
  63.             if ($establishment->getStatus() === $this) {
  64.                 $establishment->setStatus(null);
  65.             }
  66.         }
  67.         return $this;
  68.     }
  69. }