src/Entity/Gos/Language.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\FmCompanySettings;
  4. use App\Entity\Gos\Uniqskills\PromoBox;
  5. use App\Entity\Gos\Uniqskills\Slider;
  6. use App\Entity\Gos\Uniqskills\Voucher;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. /**
  12.  * @ORM\Table()
  13.  * @ORM\Entity(repositoryClass="App\Repository\LanguageRepository")
  14.  * @ORM\HasLifecycleCallbacks
  15.  */
  16. class Language
  17. {
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="IDENTITY")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="boolean", nullable=true)
  26.      */
  27.     private $isActive;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $name;
  32.     /**
  33.      * @ORM\Column(type="string")
  34.      */
  35.     private $native;
  36.     /**
  37.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Country", mappedBy="language")
  38.      */
  39.     private $country;
  40.     /**
  41.      * @Gedmo\Slug(fields={"name"})
  42.      * @ORM\Column(unique=true)
  43.      */
  44.     private $slug;
  45.     /**
  46.      * @ORM\Column(type="string", length=5)
  47.      */
  48.     private $code;
  49.     /**
  50.      * @ORM\Column(type="string", length=6, nullable=true)
  51.      */
  52.     private $short;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity="EmailTemplate", mappedBy="language")
  55.      */
  56.     private $emailTemplate;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Category", mappedBy="language")
  59.      */
  60.     private $categories;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Uniqskills\PromoBox", mappedBy="language")
  63.      */
  64.     private $promoBox;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Uniqskills\Slider", mappedBy="language")
  67.      */
  68.     private $slider;
  69.     /**
  70.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Uniqskills\FmCompanySettings", mappedBy="language")
  71.      */
  72.     private $fmCompanySettings;
  73.     /**
  74.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Uniqskills\Voucher", mappedBy="isDefaultForLanguage")
  75.      */
  76.     private $vouchers;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity="Term", mappedBy="language")
  79.      */
  80.     private $terms;
  81.     /**
  82.      * @ORM\Column(type="datetime")
  83.      */
  84.     private $createdAt;
  85.     /**
  86.      * @ORM\Column(type="datetime", nullable=true)
  87.      */
  88.     private $updatedAt;
  89.     /**
  90.      * @ORM\OneToMany(targetEntity="NotificationForUser", mappedBy="language")
  91.      */
  92.     private $notificationForUser;
  93.     /** @ORM\PrePersist() */
  94.     public function prePersist()
  95.     {
  96.         $this->createdAt = new \DateTime();
  97.     }
  98.     /** @ORM\PreUpdate() */
  99.     public function preUpdate()
  100.     {
  101.         $this->updatedAt = new \DateTime();
  102.     }
  103.     public function __toString()
  104.     {
  105.         return (string)$this->name;
  106.     }
  107.     /* ****************************** GETTERS & SETTERS ******************************  */
  108.     /**
  109.      * Constructor
  110.      */
  111.     public function __construct()
  112.     {
  113.         $this->country = new ArrayCollection();
  114.         $this->vouchers = new ArrayCollection();
  115.         $this->slider = new ArrayCollection();
  116.         $this->promoBox = new ArrayCollection();
  117.         $this->categories = new ArrayCollection();
  118.         $this->emailTemplate = new ArrayCollection();
  119.         $this->fmCompanySettings = new ArrayCollection();
  120.         $this->terms = new ArrayCollection();
  121.         $this->notificationForUser = new ArrayCollection();
  122.     }
  123.     /**
  124.      * Get id
  125.      *
  126.      * @return integer 
  127.      */
  128.     public function getId()
  129.     {
  130.         return $this->id;
  131.     }
  132.     /**
  133.      * Set isActive
  134.      *
  135.      * @param boolean $isActive
  136.      * @return Language
  137.      */
  138.     public function setIsActive($isActive)
  139.     {
  140.         $this->isActive $isActive;
  141.         return $this;
  142.     }
  143.     /**
  144.      * Get isActive
  145.      *
  146.      * @return boolean 
  147.      */
  148.     public function getIsActive()
  149.     {
  150.         return $this->isActive;
  151.     }
  152.     /**
  153.      * Set name
  154.      *
  155.      * @param string $name
  156.      * @return Language
  157.      */
  158.     public function setName($name)
  159.     {
  160.         $this->name $name;
  161.         return $this;
  162.     }
  163.     /**
  164.      * Get name
  165.      *
  166.      * @return string 
  167.      */
  168.     public function getName()
  169.     {
  170.         return $this->name;
  171.     }
  172.     /**
  173.      * Set native
  174.      *
  175.      * @param string $native
  176.      * @return Language
  177.      */
  178.     public function setNative($native)
  179.     {
  180.         $this->native $native;
  181.         return $this;
  182.     }
  183.     /**
  184.      * Get native
  185.      *
  186.      * @return string 
  187.      */
  188.     public function getNative()
  189.     {
  190.         return $this->native;
  191.     }
  192.     /**
  193.      * Set slug
  194.      *
  195.      * @param string $slug
  196.      * @return Language
  197.      */
  198.     public function setSlug($slug)
  199.     {
  200.         $this->slug $slug;
  201.         return $this;
  202.     }
  203.     /**
  204.      * Get slug
  205.      *
  206.      * @return string 
  207.      */
  208.     public function getSlug()
  209.     {
  210.         return $this->slug;
  211.     }
  212.     /**
  213.      * Set code
  214.      *
  215.      * @param string $code
  216.      * @return Language
  217.      */
  218.     public function setCode($code)
  219.     {
  220.         $this->code $code;
  221.         return $this;
  222.     }
  223.     /**
  224.      * Get code
  225.      *
  226.      * @return string 
  227.      */
  228.     public function getCode()
  229.     {
  230.         return $this->code;
  231.     }
  232.     /**
  233.      * Set createdAt
  234.      *
  235.      * @param \DateTime $createdAt
  236.      * @return Language
  237.      */
  238.     public function setCreatedAt($createdAt)
  239.     {
  240.         $this->createdAt $createdAt;
  241.         return $this;
  242.     }
  243.     /**
  244.      * Get createdAt
  245.      *
  246.      * @return \DateTime 
  247.      */
  248.     public function getCreatedAt()
  249.     {
  250.         return $this->createdAt;
  251.     }
  252.     /**
  253.      * Set updatedAt
  254.      *
  255.      * @param \DateTime $updatedAt
  256.      * @return Language
  257.      */
  258.     public function setUpdatedAt($updatedAt)
  259.     {
  260.         $this->updatedAt $updatedAt;
  261.         return $this;
  262.     }
  263.     /**
  264.      * Get updatedAt
  265.      *
  266.      * @return \DateTime 
  267.      */
  268.     public function getUpdatedAt()
  269.     {
  270.         return $this->updatedAt;
  271.     }
  272.     /**
  273.      * Set short
  274.      *
  275.      * @param string $short
  276.      *
  277.      * @return Language
  278.      */
  279.     public function setShort($short)
  280.     {
  281.         $this->short $short;
  282.         return $this;
  283.     }
  284.     /**
  285.      * Get short
  286.      *
  287.      * @return string
  288.      */
  289.     public function getShort()
  290.     {
  291.         return $this->short;
  292.     }
  293.     /**
  294.      * Add country
  295.      *
  296.      * @param \App\Entity\Gos\Country $country
  297.      *
  298.      * @return Language
  299.      */
  300.     public function addCountry(\App\Entity\Gos\Country $country)
  301.     {
  302.         $this->country[] = $country;
  303.         return $this;
  304.     }
  305.     /**
  306.      * Remove country
  307.      *
  308.      * @param \App\Entity\Gos\Country $country
  309.      */
  310.     public function removeCountry(\App\Entity\Gos\Country $country)
  311.     {
  312.         $this->country->removeElement($country);
  313.     }
  314.     /**
  315.      * Get country
  316.      *
  317.      * @return \Doctrine\Common\Collections\Collection
  318.      */
  319.     public function getCountry()
  320.     {
  321.         return $this->country;
  322.     }
  323.     /**
  324.      * @return Collection|Voucher[]
  325.      */
  326.     public function getVouchers(): Collection
  327.     {
  328.         return $this->vouchers;
  329.     }
  330.     public function addVoucher(Voucher $voucher): self
  331.     {
  332.         if (!$this->vouchers->contains($voucher)) {
  333.             $this->vouchers[] = $voucher;
  334.             $voucher->addIsDefaultForLanguage($this);
  335.         }
  336.         return $this;
  337.     }
  338.     public function removeVoucher(Voucher $voucher): self
  339.     {
  340.         if ($this->vouchers->contains($voucher)) {
  341.             $this->vouchers->removeElement($voucher);
  342.             $voucher->removeIsDefaultForLanguage($this);
  343.         }
  344.         return $this;
  345.     }
  346.     /**
  347.      * @return Collection|Slider[]
  348.      */
  349.     public function getSlider(): Collection
  350.     {
  351.         return $this->slider;
  352.     }
  353.     public function addSlider(Slider $slider): self
  354.     {
  355.         if (!$this->slider->contains($slider)) {
  356.             $this->slider[] = $slider;
  357.             $slider->setLanguage($this);
  358.         }
  359.         return $this;
  360.     }
  361.     public function removeSlider(Slider $slider): self
  362.     {
  363.         if ($this->slider->contains($slider)) {
  364.             $this->slider->removeElement($slider);
  365.             // set the owning side to null (unless already changed)
  366.             if ($slider->getLanguage() === $this) {
  367.                 $slider->setLanguage(null);
  368.             }
  369.         }
  370.         return $this;
  371.     }
  372.     /**
  373.      * @return Collection|PromoBox[]
  374.      */
  375.     public function getPromoBox(): Collection
  376.     {
  377.         return $this->promoBox;
  378.     }
  379.     public function addPromoBox(PromoBox $promoBox): self
  380.     {
  381.         if (!$this->promoBox->contains($promoBox)) {
  382.             $this->promoBox[] = $promoBox;
  383.             $promoBox->setLanguage($this);
  384.         }
  385.         return $this;
  386.     }
  387.     public function removePromoBox(PromoBox $promoBox): self
  388.     {
  389.         if ($this->promoBox->contains($promoBox)) {
  390.             $this->promoBox->removeElement($promoBox);
  391.             // set the owning side to null (unless already changed)
  392.             if ($promoBox->getLanguage() === $this) {
  393.                 $promoBox->setLanguage(null);
  394.             }
  395.         }
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection|Category[]
  400.      */
  401.     public function getCategories(): Collection
  402.     {
  403.         return $this->categories;
  404.     }
  405.     public function addCategory(Category $category): self
  406.     {
  407.         if (!$this->categories->contains($category)) {
  408.             $this->categories[] = $category;
  409.             $category->setLanguage($this);
  410.         }
  411.         return $this;
  412.     }
  413.     public function removeCategory(Category $category): self
  414.     {
  415.         if ($this->categories->contains($category)) {
  416.             $this->categories->removeElement($category);
  417.             // set the owning side to null (unless already changed)
  418.             if ($category->getLanguage() === $this) {
  419.                 $category->setLanguage(null);
  420.             }
  421.         }
  422.         return $this;
  423.     }
  424.     /**
  425.      * @return Collection|EmailTemplate[]
  426.      */
  427.     public function getEmailTemplate(): Collection
  428.     {
  429.         return $this->emailTemplate;
  430.     }
  431.     public function addEmailTemplate(EmailTemplate $emailTemplate): self
  432.     {
  433.         if (!$this->emailTemplate->contains($emailTemplate)) {
  434.             $this->emailTemplate[] = $emailTemplate;
  435.             $emailTemplate->setLanguage($this);
  436.         }
  437.         return $this;
  438.     }
  439.     public function removeEmailTemplate(EmailTemplate $emailTemplate): self
  440.     {
  441.         if ($this->emailTemplate->contains($emailTemplate)) {
  442.             $this->emailTemplate->removeElement($emailTemplate);
  443.             // set the owning side to null (unless already changed)
  444.             if ($emailTemplate->getLanguage() === $this) {
  445.                 $emailTemplate->setLanguage(null);
  446.             }
  447.         }
  448.         return $this;
  449.     }
  450.     /**
  451.      * @return Collection|FmCompanySettings[]
  452.      */
  453.     public function getFmCompanySettings(): Collection
  454.     {
  455.         return $this->fmCompanySettings;
  456.     }
  457.     public function addFmCompanySetting(FmCompanySettings $fmCompanySetting): self
  458.     {
  459.         if (!$this->fmCompanySettings->contains($fmCompanySetting)) {
  460.             $this->fmCompanySettings[] = $fmCompanySetting;
  461.             $fmCompanySetting->addLanguage($this);
  462.         }
  463.         return $this;
  464.     }
  465.     public function removeFmCompanySetting(FmCompanySettings $fmCompanySetting): self
  466.     {
  467.         if ($this->fmCompanySettings->contains($fmCompanySetting)) {
  468.             $this->fmCompanySettings->removeElement($fmCompanySetting);
  469.             $fmCompanySetting->removeLanguage($this);
  470.         }
  471.         return $this;
  472.     }
  473.     /**
  474.      * @return Collection|Term[]
  475.      */
  476.     public function getTerms(): Collection
  477.     {
  478.         return $this->terms;
  479.     }
  480.     public function addTerm(Term $term): self
  481.     {
  482.         if (!$this->terms->contains($term)) {
  483.             $this->terms[] = $term;
  484.             $term->setLanguage($this);
  485.         }
  486.         return $this;
  487.     }
  488.     public function removeTerm(Term $term): self
  489.     {
  490.         if ($this->terms->contains($term)) {
  491.             $this->terms->removeElement($term);
  492.             // set the owning side to null (unless already changed)
  493.             if ($term->getLanguage() === $this) {
  494.                 $term->setLanguage(null);
  495.             }
  496.         }
  497.         return $this;
  498.     }
  499.     /**
  500.      * @return Collection|Language[]
  501.      */
  502.     public function getNotificationForUser(): Collection
  503.     {
  504.         return $this->notificationForUser;
  505.     }
  506.     public function addNotificationForUser(NotificationForUser $notificationForUser): self
  507.     {
  508.         if (!$this->notificationForUser->contains($notificationForUser)) {
  509.             $this->notificationForUser[] = $notificationForUser;
  510.             $notificationForUser->setCourse($this);
  511.         }
  512.         return $this;
  513.     }
  514.     public function removeNotificationForUser(NotificationForUser $notificationForUser): self
  515.     {
  516.         if ($this->notificationForUser->contains($notificationForUser)) {
  517.             $this->notificationForUser->removeElement($notificationForUser);
  518.         }
  519.         return $this;
  520.     }
  521. }