src/Entity/ClientType.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ClientTypeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassClientTypeRepository::class)]
  9. #[ApiResource]
  10. class ClientType
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $clientTypeLabel null;
  18.     #[ORM\OneToMany(mappedBy'thirdPartyClientType'targetEntityThirdParty::class, orphanRemovaltrue)]
  19.     private Collection $thirdParties;
  20.     public function __construct()
  21.     {
  22.         $this->thirdParties = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getClientTypeLabel(): ?string
  29.     {
  30.         return $this->clientTypeLabel;
  31.     }
  32.     public function setClientTypeLabel(string $clientTypeLabel): self
  33.     {
  34.         $this->clientTypeLabel $clientTypeLabel;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, ThirdParty>
  39.      */
  40.     public function getThirdParties(): Collection
  41.     {
  42.         return $this->thirdParties;
  43.     }
  44.     public function addThirdParty(ThirdParty $thirdParty): self
  45.     {
  46.         if (!$this->thirdParties->contains($thirdParty)) {
  47.             $this->thirdParties->add($thirdParty);
  48.             $thirdParty->setThirdPartyClientType($this);
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeThirdParty(ThirdParty $thirdParty): self
  53.     {
  54.         if ($this->thirdParties->removeElement($thirdParty)) {
  55.             // set the owning side to null (unless already changed)
  56.             if ($thirdParty->getThirdPartyClientType() === $this) {
  57.                 $thirdParty->setThirdPartyClientType(null);
  58.             }
  59.         }
  60.         return $this;
  61.     }
  62. }