src/Entity/CRM/ContractTemplate.php line 12

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Entity\CRM\Product;
  4. use App\Repository\ContractTemplateRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassContractTemplateRepository::class)]
  9. class ContractTemplate
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $fileName null;
  19.     #[ORM\Column]
  20.     private ?bool $active null;
  21.     #[ORM\OneToMany(mappedBy'contractTemplate'targetEntityProduct::class)]
  22.     private Collection $products;
  23.     #[ORM\Column(length255)]
  24.     private ?string $type null;
  25.     #[ORM\Column(length1200nullabletrue)]
  26.     private ?string $additionalProductText null;
  27.     #[ORM\OneToMany(mappedBy'contractTemplate'targetEntityContract::class)]
  28.     private Collection $contracts;
  29.     #[ORM\Column]
  30.     private ?int $dynamicParagraphPlace null;
  31.     public function __construct()
  32.     {
  33.         $this->products = new ArrayCollection();
  34.         $this->contracts = new ArrayCollection();
  35.     }
  36.     public function __toString()
  37.     {
  38.         return $this->id.' - '.$this->title;
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getTitle(): ?string
  45.     {
  46.         return $this->title;
  47.     }
  48.     public function setTitle(string $title): static
  49.     {
  50.         $this->title $title;
  51.         return $this;
  52.     }
  53.     public function getFileName(): ?string
  54.     {
  55.         return $this->fileName;
  56.     }
  57.     public function setFileName(string $fileName): static
  58.     {
  59.         $this->fileName $fileName;
  60.         return $this;
  61.     }
  62.     public function isActive(): ?bool
  63.     {
  64.         return $this->active;
  65.     }
  66.     public function setActive(bool $active): static
  67.     {
  68.         $this->active $active;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, Product>
  73.      */
  74.     public function getProducts(): Collection
  75.     {
  76.         return $this->products;
  77.     }
  78.     public function countProducts(): int
  79.     {
  80.         return $this->products->count();
  81.     }
  82.     public function addProduct(Product $product): static
  83.     {
  84.         if (!$this->products->contains($product)) {
  85.             $this->products->add($product);
  86.             $product->setContractTemplate($this);
  87.         }
  88.         return $this;
  89.     }
  90.     public function removeProduct(Product $product): static
  91.     {
  92.         if ($this->products->removeElement($product)) {
  93.             // set the owning side to null (unless already changed)
  94.             if ($product->getContractTemplate() === $this) {
  95.                 $product->setContractTemplate(null);
  96.             }
  97.         }
  98.         return $this;
  99.     }
  100.     public function getType(): ?string
  101.     {
  102.         return $this->type;
  103.     }
  104.     public function setType(string $type): static
  105.     {
  106.         $this->type $type;
  107.         return $this;
  108.     }
  109.     public function getAdditionalProductText(): ?string
  110.     {
  111.         return $this->additionalProductText;
  112.     }
  113.     public function setAdditionalProductText(string $additionalProductText): static
  114.     {
  115.         $this->additionalProductText $additionalProductText;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, Contract>
  120.      */
  121.     public function getContracts(): Collection
  122.     {
  123.         return $this->contracts;
  124.     }
  125.     public function addContract(Contract $contract): static
  126.     {
  127.         if (!$this->contracts->contains($contract)) {
  128.             $this->contracts->add($contract);
  129.             $contract->setContractTemplate($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeContract(Contract $contract): static
  134.     {
  135.         if ($this->contracts->removeElement($contract)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($contract->getContractTemplate() === $this) {
  138.                 $contract->setContractTemplate(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     public function getDynamicParagraphPlace(): ?int
  144.     {
  145.         return $this->dynamicParagraphPlace;
  146.     }
  147.     public function setDynamicParagraphPlace(int $dynamicParagraphPlace): static
  148.     {
  149.         $this->dynamicParagraphPlace $dynamicParagraphPlace;
  150.         return $this;
  151.     }
  152. }