src/Entity/Client.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ClientRepository;
  5. use App\Traits\Timestamps;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassClientRepository::class)]
  11. #[ApiResource()]
  12. #[ORM\HasLifecycleCallbacks]
  13. class Client
  14. {
  15.     use Timestamps;
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $name null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $url null;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $website null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $plan null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $status null;
  30.     #[ORM\ManyToOne(inversedBy'client')]
  31.     private ?Plan $planClient null;
  32.     #[ORM\Column(nullabletrue)]
  33.     private ?bool $deleted null;
  34.     #[ORM\Column(length255)]
  35.     private ?string $externalId null;
  36.     #[ORM\OneToMany(mappedBy'client'targetEntityOrder::class)]
  37.     private Collection $orders;
  38.     #[ORM\OneToOne(mappedBy'client'cascade: ['persist''remove'])]
  39.     private ?Billing $billing null;
  40.     public function __construct()
  41.     {
  42.         $this->orders = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getName(): ?string
  49.     {
  50.         return $this->name;
  51.     }
  52.     public function setName(string $name): self
  53.     {
  54.         $this->name $name;
  55.         return $this;
  56.     }
  57.     public function getUrl(): ?string
  58.     {
  59.         return $this->url;
  60.     }
  61.     public function setUrl(?string $url): self
  62.     {
  63.         $this->url $url;
  64.         return $this;
  65.     }
  66.     public function getWebsite(): ?string
  67.     {
  68.         return $this->website;
  69.     }
  70.     public function setWebsite(?string $website): self
  71.     {
  72.         $this->website $website;
  73.         return $this;
  74.     }
  75.     public function getPlan(): ?string
  76.     {
  77.         return $this->plan;
  78.     }
  79.     public function setPlan(?string $plan): self
  80.     {
  81.         $this->plan $plan;
  82.         return $this;
  83.     }
  84.     public function getStatus(): ?string
  85.     {
  86.         return $this->status;
  87.     }
  88.     public function setStatus(?string $status): self
  89.     {
  90.         $this->status $status;
  91.         return $this;
  92.     }
  93.     public function __toString(): string
  94.     {
  95.         return $this->name ?? '';
  96.     }
  97.     public function getPlanClient(): ?Plan
  98.     {
  99.         return $this->planClient;
  100.     }
  101.     public function setPlanClient(?Plan $planClient): static
  102.     {
  103.         $this->planClient $planClient;
  104.         return $this;
  105.     }
  106.     public function isDeleted(): ?bool
  107.     {
  108.         return $this->deleted;
  109.     }
  110.     public function setDeleted(bool $deleted): static
  111.     {
  112.         $this->deleted $deleted;
  113.         return $this;
  114.     }
  115.     public function getExternalId(): ?string
  116.     {
  117.         return $this->externalId;
  118.     }
  119.     public function setExternalId(string $externalId): self
  120.     {
  121.         $this->externalId $externalId;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, Order>
  126.      */
  127.     public function getOrders(): Collection
  128.     {
  129.         return $this->orders;
  130.     }
  131.     public function addOrder(Order $order): static
  132.     {
  133.         if (!$this->orders->contains($order)) {
  134.             $this->orders->add($order);
  135.             $order->setClient($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeOrder(Order $order): static
  140.     {
  141.         if ($this->orders->removeElement($order)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($order->getClient() === $this) {
  144.                 $order->setClient(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     public function getBilling(): ?Billing
  150.     {
  151.         return $this->billing;
  152.     }
  153.     public function setBilling(Billing $billing): static
  154.     {
  155.         // set the owning side of the relation if necessary
  156.         if ($billing->getClient() !== $this) {
  157.             $billing->setClient($this);
  158.         }
  159.         $this->billing $billing;
  160.         return $this;
  161.     }
  162. }