src/Entity/CRM/Agreement.php line 12

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Entity\CRM\Product;
  4. use App\Repository\AgreementRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassAgreementRepository::class)]
  9. class Agreement
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $url null;
  19.     #[ORM\OneToMany(mappedBy'agreement'targetEntityProduct::class)]
  20.     private Collection $products;
  21.     #[ORM\Column(length255)]
  22.     private ?string $type null;
  23.     #[ORM\ManyToMany(targetEntityAdmin::class, inversedBy'agreementsToSendAfterSigned')]
  24.     private Collection $agreementToSendAfterSigned;
  25.     #[ORM\Column]
  26.     private ?bool $indefiniteDuration null;
  27.     #[ORM\OneToMany(mappedBy'agreement'targetEntityAgreementContractTemplateSet::class)]
  28.     private Collection $agreementContractTemplateSets;
  29.     public function __construct()
  30.     {
  31.         $this->products = new ArrayCollection();
  32.         $this->agreementToSendAfterSigned = new ArrayCollection();
  33.         $this->indefiniteDuration false;
  34.         $this->agreementContractTemplateSets = new ArrayCollection();
  35.     }
  36.     public function __toString(): string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): static
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getUrl(): ?string
  54.     {
  55.         return $this->url;
  56.     }
  57.     public function setUrl(string $url): static
  58.     {
  59.         $this->url $url;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, Product>
  64.      */
  65.     public function getProducts(): Collection
  66.     {
  67.         return $this->products;
  68.     }
  69.     public function addProduct(Product $product): static
  70.     {
  71.         if (!$this->products->contains($product)) {
  72.             $this->products->add($product);
  73.             $product->setAgreement($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeProduct(Product $product): static
  78.     {
  79.         if ($this->products->removeElement($product)) {
  80.             // set the owning side to null (unless already changed)
  81.             if ($product->getAgreement() === $this) {
  82.                 $product->setAgreement(null);
  83.             }
  84.         }
  85.         return $this;
  86.     }
  87.     public function getType(): ?string
  88.     {
  89.         return $this->type;
  90.     }
  91.     public function setType(string $type): static
  92.     {
  93.         $this->type $type;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection<int, Admin>
  98.      */
  99.     public function getAgreementToSendAfterSigned(): Collection
  100.     {
  101.         return $this->agreementToSendAfterSigned;
  102.     }
  103.     public function addAgreementToSendAfterSigned(Admin $agreementToSendAfterSigned): static
  104.     {
  105.         if (!$this->agreementToSendAfterSigned->contains($agreementToSendAfterSigned)) {
  106.             $this->agreementToSendAfterSigned->add($agreementToSendAfterSigned);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeAgreementToSendAfterSigned(Admin $agreementToSendAfterSigned): static
  111.     {
  112.         $this->agreementToSendAfterSigned->removeElement($agreementToSendAfterSigned);
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return Collection<int, AgreementContractTemplateSet>
  117.      */
  118.     public function getAgreementContractTemplateSets(): Collection
  119.     {
  120.         return $this->agreementContractTemplateSets;
  121.     }
  122.     public function addAgreementContractTemplateSet(AgreementContractTemplateSet $agreementContractTemplateSet): static
  123.     {
  124.         if (!$this->agreementContractTemplateSets->contains($agreementContractTemplateSet)) {
  125.             $this->agreementContractTemplateSets->add($agreementContractTemplateSet);
  126.             $agreementContractTemplateSet->setAgreement($this);
  127.         }
  128.         return $this;
  129.     }
  130.     public function removeAgreementContractTemplateSet(AgreementContractTemplateSet $agreementContractTemplateSet): static
  131.     {
  132.         if ($this->agreementContractTemplateSets->removeElement($agreementContractTemplateSet)) {
  133.             // set the owning side to null (unless already changed)
  134.             if ($agreementContractTemplateSet->getAgreement() === $this) {
  135.                 $agreementContractTemplateSet->setAgreement(null);
  136.             }
  137.         }
  138.         return $this;
  139.     }
  140.     public function isIndefiniteDuration(): ?bool
  141.     {
  142.         return $this->indefiniteDuration;
  143.     }
  144.     public function setIndefiniteDuration(bool $indefiniteDuration): static
  145.     {
  146.         $this->indefiniteDuration $indefiniteDuration;
  147.         return $this;
  148.     }
  149. }