src/Admin/Modules/Contract/Entity/ContractLead.php line 17

  1. <?php
  2. namespace App\Admin\Modules\Contract\Entity;
  3. use App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use App\Modules\User\Entity\User;
  10. /**
  11.  * @ORM\Table(name="contract_lead", indexes={@ORM\Index(columns={"added_at"})})
  12.  * @ORM\Entity(repositoryClass="App\Admin\Modules\Contract\Repository\ContractLeadRepository")
  13.  */
  14. class ContractLead
  15. {
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(type="bigint", options={"unsigned"=true}))
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     protected $id;
  24.     
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\Contract\Entity\ContractLeadConfig")
  27.      * @ORM\JoinColumns({
  28.      *   @ORM\JoinColumn(name="id_contract_lead_config", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  29.      * })
  30.      */
  31.     private $config;    
  32.     
  33.     /**
  34.      * @var \App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher
  35.      *
  36.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\Voucher\Entity\VoucherPackageVoucher", inversedBy="contractLead")
  37.      * @ORM\JoinColumns({
  38.      *   @ORM\JoinColumn(name="id_voucher_package_voucher", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  39.      * })
  40.      */
  41.     private $voucher;    
  42.     
  43.     /**
  44.      * @var \App\Modules\User\Entity\User
  45.      *
  46.      * @ORM\ManyToOne(targetEntity="App\Modules\User\Entity\User")
  47.      * @ORM\JoinColumns({
  48.      *   @ORM\JoinColumn(name="id_admin_user", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  49.      * })
  50.      */
  51.     private $adminUser;
  52.     
  53.     /**
  54.      * @var \DateTime
  55.      *
  56.      * @ORM\Column(name="added_at", type="datetime", nullable=false)
  57.      * @Gedmo\Timestampable(on="create")
  58.      */
  59.     private $addedAt;    
  60.     
  61.     /**
  62.      * @ORM\OneToMany(targetEntity="App\Admin\Modules\Contract\Entity\ContractLeadParam", mappedBy="lead", cascade={"persist"}, orphanRemoval=true)
  63.      * @ORM\OrderBy({"id"="ASC"})
  64.      */
  65.     private $params;
  66.     
  67.     /**
  68.      * @ORM\ManyToMany(targetEntity="App\Admin\Modules\Contract\Entity\ContractLeadConfigFlag")
  69.      * @ORM\JoinTable(name="contract_lead_flag",
  70.      *      joinColumns={@ORM\JoinColumn(name="id_contract_lead", referencedColumnName="id", onDelete="CASCADE")},
  71.      *      inverseJoinColumns={@ORM\JoinColumn(name="id_contract_lead_config_flag", referencedColumnName="id", onDelete="CASCADE")}
  72.      *    )
  73.      * @ORM\OrderBy({"name"="ASC"})
  74.      **/
  75.     private $flags;      
  76.     public function __construct()
  77.     {
  78.         $this->params = new ArrayCollection();
  79.         $this->flags = new ArrayCollection();
  80.     }
  81.     public function getId(): ?string
  82.     {
  83.         return $this->id;
  84.     }
  85.     public function getAddedAt(): ?\DateTimeInterface
  86.     {
  87.         return $this->addedAt;
  88.     }
  89.     public function setAddedAt(\DateTimeInterface $addedAt): self
  90.     {
  91.         $this->addedAt $addedAt;
  92.         return $this;
  93.     }
  94.     public function getAdminUser(): ?User
  95.     {
  96.         return $this->adminUser;
  97.     }
  98.     public function setAdminUser(?User $adminUser): self
  99.     {
  100.         $this->adminUser $adminUser;
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection<int, ContractLeadParam>
  105.      */
  106.     public function getParams(): Collection
  107.     {
  108.         return $this->params;
  109.     }
  110.     public function addParam(ContractLeadParam $param): self
  111.     {
  112.         if (!$this->params->contains($param)) {
  113.             $this->params->add($param);
  114.             $param->setLead($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeParam(ContractLeadParam $param): self
  119.     {
  120.         if ($this->params->removeElement($param)) {
  121.             // set the owning side to null (unless already changed)
  122.             if ($param->getLead() === $this) {
  123.                 $param->setLead(null);
  124.             }
  125.         }
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, ContractLeadConfigFlag>
  130.      */
  131.     public function getFlags(): Collection
  132.     {
  133.         return $this->flags;
  134.     }
  135.     public function addFlag(ContractLeadConfigFlag $flag): self
  136.     {
  137.         if (!$this->flags->contains($flag)) {
  138.             $this->flags->add($flag);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removeFlag(ContractLeadConfigFlag $flag): self
  143.     {
  144.         $this->flags->removeElement($flag);
  145.         return $this;
  146.     }
  147.     public function getVoucher(): ?VoucherPackageVoucher
  148.     {
  149.         return $this->voucher;
  150.     }
  151.     public function setVoucher(?VoucherPackageVoucher $voucher): self
  152.     {
  153.         $this->voucher $voucher;
  154.         return $this;
  155.     }
  156.     public function getConfig(): ?ContractLeadConfig
  157.     {
  158.         return $this->config;
  159.     }
  160.     public function setConfig(?ContractLeadConfig $config): self
  161.     {
  162.         $this->config $config;
  163.         return $this;
  164.     }
  165. }