src/Admin/Modules/Contract/Entity/ContractTemplate.php line 15

  1. <?php
  2. namespace App\Admin\Modules\Contract\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Table(name="contract_template", indexes={@ORM\Index(columns={"name"}), @ORM\Index(columns={"short_name"}), @ORM\Index(columns={"for_new_customers"}), @ORM\Index(columns={"is_annex"}), @ORM\Index(columns={"is_deleted"}), @ORM\Index(columns={"added_at"})})
  10.  * @ORM\Entity(repositoryClass="App\Admin\Modules\Contract\Repository\ContractTemplateRepository")
  11.  */
  12. class ContractTemplate
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(type="bigint", options={"unsigned"=true}))
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $id;
  22.     
  23.     /**
  24.      * @var string
  25.      *
  26.      * @ORM\Column(name="name", type="string", length=255, nullable=false, options={"collation"="utf8_unicode_ci"})
  27.      */
  28.     private $name;
  29.     /**
  30.      * @var string
  31.      *
  32.      * @ORM\Column(name="short_name", type="string", length=50, nullable=false, options={"collation"="utf8_unicode_ci"})
  33.      */
  34.     private $shortName;
  35.     
  36.     /**
  37.      * @var string
  38.      *
  39.      * @ORM\Column(name="content", type="text", nullable=false)
  40.      */
  41.     private $content;
  42.     
  43.     /**
  44.      * @var bool
  45.      *
  46.      * @ORM\Column(name="for_new_customers", type="boolean", nullable=false)
  47.      */
  48.     private $forNewCustomers;
  49.     
  50.     /**
  51.      * @var bool
  52.      *
  53.      * @ORM\Column(name="use_margins", type="boolean", nullable=false)
  54.      */
  55.     private $useMargins;
  56.     /**
  57.      * @var bool
  58.      *
  59.      * @ORM\Column(name="is_annex", type="boolean", nullable=false)
  60.      */
  61.     private $isAnnex;
  62.     /**
  63.      * @var bool
  64.      *
  65.      * @ORM\Column(name="is_deleted", type="boolean", nullable=false)
  66.      */
  67.     private $isDeleted;
  68.     /**
  69.      * @var \DateTime
  70.      *
  71.      * @ORM\Column(name="added_at", type="datetime", nullable=false)
  72.      * @Gedmo\Timestampable(on="create")
  73.      */
  74.     private $addedAt;
  75.     
  76.     /**
  77.      * @var \App\Admin\Modules\Contract\Entity\Contract
  78.      *
  79.      * @ORM\ManyToMany(targetEntity="App\Admin\Modules\Contract\Entity\Contract", mappedBy="documentTemplates")
  80.      **/
  81.     private $contracts;    
  82.     public function __construct()
  83.     {
  84.         $this->isDeleted false;
  85.         $this->contracts = new ArrayCollection();
  86.     }
  87.     
  88.     public function __toString()
  89.     {
  90.         return $this->getNameWithShortName();
  91.     }
  92.     
  93.     public function getId(): ?string
  94.     {
  95.         return $this->id;
  96.     }
  97.     
  98.     public function getNameWithShortName()
  99.     {
  100.         return $this->name ' (' $this->shortName ')';
  101.     }
  102.     public function getName(): ?string
  103.     {
  104.         return $this->name;
  105.     }
  106.     public function setName(string $name): self
  107.     {
  108.         $this->name $name;
  109.         return $this;
  110.     }
  111.     public function getShortName(): ?string
  112.     {
  113.         return $this->shortName;
  114.     }
  115.     public function setShortName(string $shortName): self
  116.     {
  117.         $this->shortName $shortName;
  118.         return $this;
  119.     }
  120.     public function getContent(): ?string
  121.     {
  122.         return $this->content;
  123.     }
  124.     public function setContent(string $content): self
  125.     {
  126.         $this->content $content;
  127.         return $this;
  128.     }
  129.     public function getIsDeleted(): ?bool
  130.     {
  131.         return $this->isDeleted;
  132.     }
  133.     public function setIsDeleted(bool $isDeleted): self
  134.     {
  135.         $this->isDeleted $isDeleted;
  136.         return $this;
  137.     }
  138.     public function getAddedAt(): ?\DateTimeInterface
  139.     {
  140.         return $this->addedAt;
  141.     }
  142.     public function setAddedAt(\DateTimeInterface $addedAt): self
  143.     {
  144.         $this->addedAt $addedAt;
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return Collection<int, Contract>
  149.      */
  150.     public function getContracts(): Collection
  151.     {
  152.         return $this->contracts;
  153.     }
  154.     public function addContract(Contract $contract): self
  155.     {
  156.         if (!$this->contracts->contains($contract)) {
  157.             $this->contracts->add($contract);
  158.             $contract->addDocumentTemplate($this);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeContract(Contract $contract): self
  163.     {
  164.         if ($this->contracts->removeElement($contract)) {
  165.             $contract->removeDocumentTemplate($this);
  166.         }
  167.         return $this;
  168.     }
  169.     public function getForNewCustomers(): ?bool
  170.     {
  171.         return $this->forNewCustomers;
  172.     }
  173.     public function setForNewCustomers(bool $forNewCustomers): self
  174.     {
  175.         $this->forNewCustomers $forNewCustomers;
  176.         return $this;
  177.     }
  178.     public function getIsAnnex(): ?bool
  179.     {
  180.         return $this->isAnnex;
  181.     }
  182.     public function setIsAnnex(bool $isAnnex): self
  183.     {
  184.         $this->isAnnex $isAnnex;
  185.         return $this;
  186.     }
  187.     public function getUseMargins(): ?bool
  188.     {
  189.         return $this->useMargins;
  190.     }
  191.     public function setUseMargins(bool $useMargins): self
  192.     {
  193.         $this->useMargins $useMargins;
  194.         return $this;
  195.     }
  196. }