src/Entity/Gos/Term.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * Term
  8.  *
  9.  * @ORM\Table(name="term")
  10.  * @ORM\Entity(repositoryClass="App\Repository\TermRepository")
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class Term
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var string
  25.      *
  26.      * @ORM\Column(name="name", type="string", length=255)
  27.      */
  28.     private $name;
  29.     /**
  30.      * @var string
  31.      *
  32.      * @ORM\Column(name="title", type="text", nullable=true)
  33.      */
  34.     private $title;
  35.     /**
  36.      * @var string
  37.      *
  38.      * @ORM\Column(type="text", nullable=true)
  39.      */
  40.     private $titleOfShortDescription;
  41.     /**
  42.      * @var string
  43.      * @ORM\Column(type="text", nullable=true)
  44.      */
  45.     private $shortDescription;
  46.     /**
  47.      * @var bool
  48.      *
  49.      * @ORM\Column(type="boolean", nullable=true)
  50.      */
  51.     private $isRequired;
  52.     /**
  53.      * @var bool
  54.      *
  55.      * @ORM\Column(type="boolean")
  56.      */
  57.     private $isReusable;
  58.     /**
  59.      * @var bool
  60.      *
  61.      * @ORM\Column(type="boolean", nullable=true)
  62.      */
  63.     private $checked;
  64.     /**
  65.      * @var bool
  66.      *
  67.      * @ORM\Column(type="boolean", nullable=true)
  68.      */
  69.     private $showInRegistration;
  70.     /**
  71.      * @var string
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      */
  74.     private $slug;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\TermText", mappedBy="term")
  77.      */
  78.     private $termText;
  79.     /**
  80.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\TermText", mappedBy="activeTerm")
  81.      */
  82.     private $activeTermText;
  83.     /**
  84.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="terms")
  85.      * @ORM\JoinTable(name="product_variant_has_terms")
  86.      */
  87.     private $productVariants;
  88.     /**
  89.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Product", inversedBy="terms")
  90.      * @ORM\JoinTable(name="product_has_terms")
  91.      */
  92.     private $products;
  93.     /**
  94.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="terms")
  95.      * @ORM\JoinTable(name="portal_settings_has_terms")
  96.      */
  97.     private $portalSettings;
  98.     /**
  99.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\TermType", inversedBy="terms")
  100.      * @ORM\JoinColumn()
  101.      */
  102.     private $termType;
  103.     /**
  104.      * @ORM\ManyToOne(targetEntity="Language", inversedBy="terms")
  105.      * @ORM\JoinColumn()
  106.      */
  107.     private $language;
  108.     /**
  109.      * @ORM\Column(type="datetime")
  110.      */
  111.     private $createdAt;
  112.     /**
  113.      * @ORM\Column(type="datetime", nullable=true)
  114.      */
  115.     private $updatedAt;
  116.     /**
  117.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\CooperatorGroup", inversedBy="terms")
  118.      */
  119.     private $cooperatorGroup;
  120.     /**
  121.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\TermsValidationMessage", inversedBy="terms")
  122.      */
  123.     private $termValidationMessage;
  124.     /**
  125.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ClientType", inversedBy="terms")
  126.      */
  127.     private $clientTypes;
  128.     /**
  129.      * @ORM\Column(type="integer", nullable=true)
  130.      */
  131.     private $showDaysBefore;
  132.     /**
  133.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\LeadFormResponse", mappedBy="terms")
  134.      */
  135.     private $leadFormResponses;
  136.     /**
  137.      * @ORM\ManyToMany(targetEntity=NewsletterTemplate::class, mappedBy="terms")
  138.      */
  139.     private $newsletterTemplates;
  140.     /** @ORM\PrePersist() */
  141.     public function prePersist()
  142.     {
  143.         $this->createdAt = new \DateTime();
  144.     }
  145.     /** @ORM\PreUpdate() */
  146.     public function preUpdate()
  147.     {
  148.         $this->updatedAt = new \DateTime();
  149.     }
  150.     public function __toString()
  151.     {
  152.         return (string)$this->name;
  153.     }
  154.     //------------------------------ setters & getters
  155.     /**
  156.      * Constructor
  157.      */
  158.     public function __construct()
  159.     {
  160.         $this->termText = new \Doctrine\Common\Collections\ArrayCollection();
  161.         $this->productVariants = new \Doctrine\Common\Collections\ArrayCollection();
  162.         $this->products = new \Doctrine\Common\Collections\ArrayCollection();
  163.         $this->portalSettings = new \Doctrine\Common\Collections\ArrayCollection();
  164.         $this->clientTypes = new ArrayCollection();
  165.         $this->leadFormResponses = new \Doctrine\Common\Collections\ArrayCollection();
  166.         $this->newsletterTemplates = new ArrayCollection();
  167.     }
  168.     /**
  169.      * Get id
  170.      *
  171.      * @return integer
  172.      */
  173.     public function getId()
  174.     {
  175.         return $this->id;
  176.     }
  177.     /**
  178.      * Set name
  179.      *
  180.      * @param string $name
  181.      *
  182.      * @return Term
  183.      */
  184.     public function setName($name)
  185.     {
  186.         $this->name $name;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get name
  191.      *
  192.      * @return string
  193.      */
  194.     public function getName()
  195.     {
  196.         return $this->name;
  197.     }
  198.     /**
  199.      * Set title
  200.      *
  201.      * @param string $title
  202.      *
  203.      * @return Term
  204.      */
  205.     public function setTitle($title)
  206.     {
  207.         $this->title $title;
  208.         return $this;
  209.     }
  210.     /**
  211.      * Get title
  212.      *
  213.      * @return string
  214.      */
  215.     public function getTitle()
  216.     {
  217.         return $this->title;
  218.     }
  219.     /**
  220.      * Set isRequired
  221.      *
  222.      * @param boolean $isRequired
  223.      *
  224.      * @return Term
  225.      */
  226.     public function setIsRequired($isRequired)
  227.     {
  228.         $this->isRequired $isRequired;
  229.         return $this;
  230.     }
  231.     /**
  232.      * Get isRequired
  233.      *
  234.      * @return boolean
  235.      */
  236.     public function getIsRequired()
  237.     {
  238.         return $this->isRequired;
  239.     }
  240.     public function getIsReusable(): ?bool
  241.     {
  242.         return $this->isReusable;
  243.     }
  244.     public function setIsReusable(bool $isReusable): self
  245.     {
  246.         $this->isReusable $isReusable;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Set slug
  251.      *
  252.      * @param string $slug
  253.      *
  254.      * @return Term
  255.      */
  256.     public function setSlug($slug)
  257.     {
  258.         $this->slug $slug;
  259.         return $this;
  260.     }
  261.     /**
  262.      * Get slug
  263.      *
  264.      * @return string
  265.      */
  266.     public function getSlug()
  267.     {
  268.         return $this->slug;
  269.     }
  270.     /**
  271.      * Set createdAt
  272.      *
  273.      * @param \DateTime $createdAt
  274.      *
  275.      * @return Term
  276.      */
  277.     public function setCreatedAt($createdAt)
  278.     {
  279.         $this->createdAt $createdAt;
  280.         return $this;
  281.     }
  282.     /**
  283.      * Get createdAt
  284.      *
  285.      * @return \DateTime
  286.      */
  287.     public function getCreatedAt()
  288.     {
  289.         return $this->createdAt;
  290.     }
  291.     /**
  292.      * Set updatedAt
  293.      *
  294.      * @param \DateTime $updatedAt
  295.      *
  296.      * @return Term
  297.      */
  298.     public function setUpdatedAt($updatedAt)
  299.     {
  300.         $this->updatedAt $updatedAt;
  301.         return $this;
  302.     }
  303.     /**
  304.      * Get updatedAt
  305.      *
  306.      * @return \DateTime
  307.      */
  308.     public function getUpdatedAt()
  309.     {
  310.         return $this->updatedAt;
  311.     }
  312.     /**
  313.      * Add termText
  314.      *
  315.      * @param \App\Entity\Gos\TermText $termText
  316.      *
  317.      * @return Term
  318.      */
  319.     public function addTermText(\App\Entity\Gos\TermText $termText)
  320.     {
  321.         $this->termText[] = $termText;
  322.         return $this;
  323.     }
  324.     /**
  325.      * Remove termText
  326.      *
  327.      * @param \App\Entity\Gos\TermText $termText
  328.      */
  329.     public function removeTermText(\App\Entity\Gos\TermText $termText)
  330.     {
  331.         $this->termText->removeElement($termText);
  332.     }
  333.     /**
  334.      * Get termText
  335.      *
  336.      * @return \Doctrine\Common\Collections\Collection
  337.      */
  338.     public function getTermText()
  339.     {
  340.         return $this->termText;
  341.     }
  342.     /**
  343.      * Set activeTermText
  344.      *
  345.      * @param \App\Entity\Gos\TermText $activeTermText
  346.      *
  347.      * @return Term
  348.      */
  349.     public function setActiveTermText(\App\Entity\Gos\TermText $activeTermText null)
  350.     {
  351.         $this->activeTermText $activeTermText;
  352.         return $this;
  353.     }
  354.     /**
  355.      * Get activeTermText
  356.      *
  357.      * @return \App\Entity\Gos\TermText
  358.      */
  359.     public function getActiveTermText()
  360.     {
  361.         return $this->activeTermText;
  362.     }
  363.     /**
  364.      * Add productVariant
  365.      *
  366.      * @param \App\Entity\Gos\ProductVariant $productVariant
  367.      *
  368.      * @return Term
  369.      */
  370.     public function addProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  371.     {
  372.         $this->productVariants[] = $productVariant;
  373.         return $this;
  374.     }
  375.     /**
  376.      * Remove productVariant
  377.      *
  378.      * @param \App\Entity\Gos\ProductVariant $productVariant
  379.      */
  380.     public function removeProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  381.     {
  382.         $this->productVariants->removeElement($productVariant);
  383.     }
  384.     /**
  385.      * Get productVariants
  386.      *
  387.      * @return \Doctrine\Common\Collections\Collection
  388.      */
  389.     public function getProductVariants()
  390.     {
  391.         return $this->productVariants;
  392.     }
  393.     /**
  394.      * Add product
  395.      *
  396.      * @param \App\Entity\Gos\Product $product
  397.      *
  398.      * @return Term
  399.      */
  400.     public function addProduct(\App\Entity\Gos\Product $product)
  401.     {
  402.         $this->products[] = $product;
  403.         return $this;
  404.     }
  405.     /**
  406.      * Remove product
  407.      *
  408.      * @param \App\Entity\Gos\Product $product
  409.      */
  410.     public function removeProduct(\App\Entity\Gos\Product $product)
  411.     {
  412.         $this->products->removeElement($product);
  413.     }
  414.     /**
  415.      * Get products
  416.      *
  417.      * @return \Doctrine\Common\Collections\Collection
  418.      */
  419.     public function getProducts()
  420.     {
  421.         return $this->products;
  422.     }
  423.     /**
  424.      * Add portalSetting
  425.      *
  426.      * @param \App\Entity\Gos\PortalSettings $portalSetting
  427.      *
  428.      * @return Term
  429.      */
  430.     public function addPortalSetting(\App\Entity\Gos\PortalSettings $portalSetting)
  431.     {
  432.         $this->portalSettings[] = $portalSetting;
  433.         return $this;
  434.     }
  435.     /**
  436.      * Remove portalSetting
  437.      *
  438.      * @param \App\Entity\Gos\PortalSettings $portalSetting
  439.      */
  440.     public function removePortalSetting(\App\Entity\Gos\PortalSettings $portalSetting)
  441.     {
  442.         $this->portalSettings->removeElement($portalSetting);
  443.     }
  444.     /**
  445.      * Get portalSettings
  446.      *
  447.      * @return \Doctrine\Common\Collections\Collection
  448.      */
  449.     public function getPortalSettings()
  450.     {
  451.         return $this->portalSettings;
  452.     }
  453.     /**
  454.      * Set termType
  455.      *
  456.      * @param \App\Entity\Gos\TermType $termType
  457.      *
  458.      * @return Term
  459.      */
  460.     public function setTermType(\App\Entity\Gos\TermType $termType null)
  461.     {
  462.         $this->termType $termType;
  463.         return $this;
  464.     }
  465.     /**
  466.      * Get termType
  467.      *
  468.      * @return \App\Entity\Gos\TermType
  469.      */
  470.     public function getTermType()
  471.     {
  472.         return $this->termType;
  473.     }
  474.     /**
  475.      * Set checked
  476.      *
  477.      * @param boolean $checked
  478.      *
  479.      * @return Term
  480.      */
  481.     public function setChecked($checked)
  482.     {
  483.         $this->checked $checked;
  484.         return $this;
  485.     }
  486.     /**
  487.      * Get checked
  488.      *
  489.      * @return boolean
  490.      */
  491.     public function getChecked()
  492.     {
  493.         return $this->checked;
  494.     }
  495.     /**
  496.      * Set showInRegistration
  497.      *
  498.      * @param boolean $showInRegistration
  499.      *
  500.      * @return Term
  501.      */
  502.     public function setShowInRegistration($showInRegistration)
  503.     {
  504.         $this->showInRegistration $showInRegistration;
  505.         return $this;
  506.     }
  507.     /**
  508.      * Get showInRegistration
  509.      *
  510.      * @return boolean
  511.      */
  512.     public function getShowInRegistration()
  513.     {
  514.         return $this->showInRegistration;
  515.     }
  516.     public function getTitleOfShortDescription(): ?string
  517.     {
  518.         return $this->titleOfShortDescription;
  519.     }
  520.     public function setTitleOfShortDescription(?string $titleOfShortDescription): self
  521.     {
  522.         $this->titleOfShortDescription $titleOfShortDescription;
  523.         return $this;
  524.     }
  525.     public function getShortDescription(): ?string
  526.     {
  527.         return $this->shortDescription;
  528.     }
  529.     public function setShortDescription(?string $shortDescription): self
  530.     {
  531.         $this->shortDescription $shortDescription;
  532.         return $this;
  533.     }
  534.     public function getLanguage(): ?Language
  535.     {
  536.         return $this->language;
  537.     }
  538.     public function setLanguage(?Language $language): self
  539.     {
  540.         $this->language $language;
  541.         return $this;
  542.     }
  543.     public function getCooperatorGroup(): ?CooperatorGroup
  544.     {
  545.         return $this->cooperatorGroup;
  546.     }
  547.     public function setCooperatorGroup(?CooperatorGroup $cooperatorGroup): self
  548.     {
  549.         $this->cooperatorGroup $cooperatorGroup;
  550.         return $this;
  551.     }
  552.     public function getTermValidationMessage(): ?TermsValidationMessage
  553.     {
  554.         return $this->termValidationMessage;
  555.     }
  556.     public function setTermValidationMessage(?TermsValidationMessage $termValidationMessage): self
  557.     {
  558.         $this->termValidationMessage $termValidationMessage;
  559.         return $this;
  560.     }
  561.     public function getClientTypes()
  562.     {
  563.         return $this->clientTypes;
  564.     }
  565.     public function addClientType(ClientType $clientType): self
  566.     {
  567.         if (!$this->clientTypes->contains($clientType)) {
  568.             $this->clientTypes[] = $clientType;
  569.         }
  570.         return $this;
  571.     }
  572.     public function removeClientType(ClientType $clientType): self
  573.     {
  574.         if ($this->clientTypes->contains($clientType)) {
  575.             $this->clientTypes->removeElement($clientType);
  576.         }
  577.         return $this;
  578.     }
  579.     public function getShowDaysBefore(): ?int
  580.     {
  581.         return $this->showDaysBefore;
  582.     }
  583.     public function setShowDaysBefore(?int $showDaysBefore): self
  584.     {
  585.         $this->showDaysBefore $showDaysBefore;
  586.         return $this;
  587.     }
  588.     public function getLeadFormResponses()
  589.     {
  590.         return $this->leadFormResponses;
  591.     }
  592.     public function addLeadFormResponse(LeadFormResponse $leadFormResponse): self
  593.     {
  594.         if (!$this->leadFormResponses->contains($leadFormResponse)) {
  595.             $this->leadFormResponses[] = $leadFormResponse;
  596.         }
  597.         return $this;
  598.     }
  599.     public function removeLeadFormResponse(LeadFormResponse $leadFormResponse): self
  600.     {
  601.         if ($this->clientTypes->contains($leadFormResponse)) {
  602.             $this->clientTypes->removeElement($leadFormResponse);
  603.         }
  604.         return $this;
  605.     }
  606.     /**
  607.      * @return Collection|NewsletterTemplate[]
  608.      */
  609.     public function getNewsletterTemplates(): Collection
  610.     {
  611.         return $this->newsletterTemplates;
  612.     }
  613.     public function addNewsletterTemplate(NewsletterTemplate $newsletterTemplate): self
  614.     {
  615.         if (!$this->newsletterTemplates->contains($newsletterTemplate)) {
  616.             $this->newsletterTemplates[] = $newsletterTemplate;
  617.             $newsletterTemplate->addTerm($this);
  618.         }
  619.         return $this;
  620.     }
  621.     public function removeNewsletterTemplate(NewsletterTemplate $newsletterTemplate): self
  622.     {
  623.         if ($this->newsletterTemplates->contains($newsletterTemplate)) {
  624.             $this->newsletterTemplates->removeElement($newsletterTemplate);
  625.             $newsletterTemplate->removeTerm($this);
  626.         }
  627.         return $this;
  628.     }
  629. }