src/Notaris/AdminBundle/Entity/Tag.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: lisavandaele
  5.  * Date: 30/01/15
  6.  * Time: 12:53
  7.  */
  8. namespace Notaris\AdminBundle\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ORM\Entity(repositoryClass="TagRepository")
  14.  * @ORM\Table(name="tag",uniqueConstraints={
  15.  *     @ORM\UniqueConstraint(name="unique_tag", columns={"name", "locale"})})
  16.  */
  17. class Tag {
  18.     /**
  19.      * @var integer
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="name", type="string", length=255)
  30.      * @Assert\Type("string")
  31.      * @Assert\NotBlank()
  32.      */
  33.     private $name;
  34.     /**
  35.      * @ORM\Column(type="text", name="description", nullable=true)
  36.      */
  37.     private $description;
  38.     /**
  39.      * @Gedmo\Slug(fields={"name"})
  40.      * @ORM\Column(length=128, unique=true)
  41.      */
  42.     private $slug;
  43.     /**
  44.      * @var string
  45.      *
  46.      * @ORM\Column(name="locale", type="string", length=5)
  47.      */
  48.     private $locale;
  49.     /**
  50.      * @var integer
  51.      *
  52.      * @ORM\Column(type="integer", name="count_clicked")
  53.      */
  54.     private $countClicked = 0;
  55.     /**
  56.      * @ORM\ManyToMany(targetEntity="Subsite")
  57.      * @ORM\JoinTable(name="tag_subsite")
  58.      * @ORM\OrderBy({"position" = "asc"})
  59.      */
  60.     protected $subsites;
  61.     /**
  62.      * @Gedmo\Timestampable(on="create")
  63.      * @ORM\Column(name="created", type="datetime")
  64.      */
  65.     private $created;
  66.     /**
  67.      * @ORM\Column(name="updated", type="datetime")
  68.      * @Gedmo\Timestampable(on="update")
  69.      */
  70.     private $updated;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
  73.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
  74.      */
  75.     private $user;
  76.     /**
  77.      * @ORM\ManyToMany(targetEntity="Video", mappedBy="tags")
  78.      */
  79.     protected $videos;
  80.     /**
  81.      * @ORM\ManyToMany(targetEntity="Section", mappedBy="tags")
  82.      */
  83.     protected $sections;
  84.     /**
  85.      * @ORM\ManyToMany(targetEntity="News", mappedBy="tags")
  86.      */
  87.     protected $newsitems;
  88.     /**
  89.      * @ORM\ManyToMany(targetEntity="Brochure", mappedBy="tags")
  90.      */
  91.     protected $brochures;
  92.     /**
  93.      * @ORM\ManyToMany(targetEntity="Glossary", mappedBy="tags")
  94.      */
  95.     protected $glossaries;
  96.     /**
  97.      * @ORM\ManyToMany(targetEntity="Faq", mappedBy="tags")
  98.      */
  99.     protected $faqItems;
  100.     /**
  101.      * Get id
  102.      *
  103.      * @return integer
  104.      */
  105.     public function getId()
  106.     {
  107.         return $this->id;
  108.     }
  109.     /**
  110.      * Set name
  111.      *
  112.      * @param string $name
  113.      * @return Tag
  114.      */
  115.     public function setName($name)
  116.     {
  117.         $this->name = $name;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get name
  122.      *
  123.      * @return string
  124.      */
  125.     public function getName()
  126.     {
  127.         return $this->name;
  128.     }
  129.     /**
  130.      * Set locale
  131.      *
  132.      * @param string $locale
  133.      * @return Tag
  134.      */
  135.     public function setLocale($locale)
  136.     {
  137.         $this->locale = $locale;
  138.         return $this;
  139.     }
  140.     /**
  141.      * Get locale
  142.      *
  143.      * @return string
  144.      */
  145.     public function getLocale()
  146.     {
  147.         return $this->locale;
  148.     }
  149.     /**
  150.      * Set countClicked
  151.      *
  152.      * @param integer $countClicked
  153.      * @return Tag
  154.      */
  155.     public function setCountClicked($countClicked)
  156.     {
  157.         $this->countClicked = $countClicked;
  158.         return $this;
  159.     }
  160.     /**
  161.      * Get countClicked
  162.      *
  163.      * @return integer
  164.      */
  165.     public function getCountClicked()
  166.     {
  167.         return $this->countClicked;
  168.     }
  169.     /**
  170.      * Set created
  171.      *
  172.      * @param \DateTime $created
  173.      * @return Tag
  174.      */
  175.     public function setCreated($created)
  176.     {
  177.         $this->created = $created;
  178.         return $this;
  179.     }
  180.     /**
  181.      * Get created
  182.      *
  183.      * @return \DateTime
  184.      */
  185.     public function getCreated()
  186.     {
  187.         return $this->created;
  188.     }
  189.     /**
  190.      * Set updated
  191.      *
  192.      * @param \DateTime $updated
  193.      * @return Tag
  194.      */
  195.     public function setUpdated($updated)
  196.     {
  197.         $this->updated = $updated;
  198.         return $this;
  199.     }
  200.     /**
  201.      * Get updated
  202.      *
  203.      * @return \DateTime
  204.      */
  205.     public function getUpdated()
  206.     {
  207.         return $this->updated;
  208.     }
  209.     /**
  210.      * Set user
  211.      *
  212.      * @param \Notaris\AdminBundle\Entity\User $user
  213.      * @return Tag
  214.      */
  215.     public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
  216.     {
  217.         $this->user = $user;
  218.         return $this;
  219.     }
  220.     /**
  221.      * Get user
  222.      *
  223.      * @return \Notaris\AdminBundle\Entity\User
  224.      */
  225.     public function getUser()
  226.     {
  227.         return $this->user;
  228.     }
  229.     /**
  230.      * Set slug
  231.      *
  232.      * @param string $slug
  233.      * @return Tag
  234.      */
  235.     public function setSlug($slug)
  236.     {
  237.         $this->slug = $slug;
  238.         return $this;
  239.     }
  240.     /**
  241.      * Get slug
  242.      *
  243.      * @return string
  244.      */
  245.     public function getSlug()
  246.     {
  247.         return $this->slug;
  248.     }
  249.     /**
  250.      * Constructor
  251.      */
  252.     public function __construct()
  253.     {
  254.         $this->videos = new \Doctrine\Common\Collections\ArrayCollection();
  255.         $this->sections = new \Doctrine\Common\Collections\ArrayCollection();
  256.         $this->newsitems = new \Doctrine\Common\Collections\ArrayCollection();
  257.     }
  258.     /**
  259.      * Add videos
  260.      *
  261.      * @param \Notaris\AdminBundle\Entity\Video $videos
  262.      * @return Tag
  263.      */
  264.     public function addVideo(\Notaris\AdminBundle\Entity\Video $videos)
  265.     {
  266.         $this->videos[] = $videos;
  267.         return $this;
  268.     }
  269.     /**
  270.      * Remove videos
  271.      *
  272.      * @param \Notaris\AdminBundle\Entity\Video $videos
  273.      */
  274.     public function removeVideo(\Notaris\AdminBundle\Entity\Video $videos)
  275.     {
  276.         $this->videos->removeElement($videos);
  277.     }
  278.     /**
  279.      * Get videos
  280.      *
  281.      * @return \Doctrine\Common\Collections\Collection
  282.      */
  283.     public function getVideos()
  284.     {
  285.         return $this->videos;
  286.     }
  287.     /**
  288.      * Add sections
  289.      *
  290.      * @param \Notaris\AdminBundle\Entity\Section $sections
  291.      * @return Tag
  292.      */
  293.     public function addSection(\Notaris\AdminBundle\Entity\Section $sections)
  294.     {
  295.         $this->sections[] = $sections;
  296.         return $this;
  297.     }
  298.     /**
  299.      * Remove sections
  300.      *
  301.      * @param \Notaris\AdminBundle\Entity\Section $sections
  302.      */
  303.     public function removeSection(\Notaris\AdminBundle\Entity\Section $sections)
  304.     {
  305.         $this->sections->removeElement($sections);
  306.     }
  307.     /**
  308.      * Get sections
  309.      *
  310.      * @return \Doctrine\Common\Collections\Collection
  311.      */
  312.     public function getSections()
  313.     {
  314.         return $this->sections;
  315.     }
  316.     /**
  317.      * Add newsitems
  318.      *
  319.      * @param \Notaris\AdminBundle\Entity\News $newsitems
  320.      * @return Tag
  321.      */
  322.     public function addNewsitem(\Notaris\AdminBundle\Entity\News $newsitems)
  323.     {
  324.         $this->newsitems[] = $newsitems;
  325.         return $this;
  326.     }
  327.     /**
  328.      * Remove newsitems
  329.      *
  330.      * @param \Notaris\AdminBundle\Entity\News $newsitems
  331.      */
  332.     public function removeNewsitem(\Notaris\AdminBundle\Entity\News $newsitems)
  333.     {
  334.         $this->newsitems->removeElement($newsitems);
  335.     }
  336.     /**
  337.      * Get newsitems
  338.      *
  339.      * @return \Doctrine\Common\Collections\Collection
  340.      */
  341.     public function getNewsitems()
  342.     {
  343.         return $this->newsitems;
  344.     }
  345.     /**
  346.      * Add brochures
  347.      *
  348.      * @param \Notaris\AdminBundle\Entity\Brochure $brochures
  349.      * @return Tag
  350.      */
  351.     public function addBrochure(\Notaris\AdminBundle\Entity\Brochure $brochures)
  352.     {
  353.         $this->brochures[] = $brochures;
  354.         return $this;
  355.     }
  356.     /**
  357.      * Remove brochures
  358.      *
  359.      * @param \Notaris\AdminBundle\Entity\Brochure $brochures
  360.      */
  361.     public function removeBrochure(\Notaris\AdminBundle\Entity\Brochure $brochures)
  362.     {
  363.         $this->brochures->removeElement($brochures);
  364.     }
  365.     /**
  366.      * Get brochures
  367.      *
  368.      * @return \Doctrine\Common\Collections\Collection
  369.      */
  370.     public function getBrochures()
  371.     {
  372.         return $this->brochures;
  373.     }
  374.     /**
  375.      * Add glossaries
  376.      *
  377.      * @param \Notaris\AdminBundle\Entity\Glossary $glossaries
  378.      * @return Tag
  379.      */
  380.     public function addGlossary(\Notaris\AdminBundle\Entity\Glossary $glossaries)
  381.     {
  382.         $this->glossaries[] = $glossaries;
  383.         return $this;
  384.     }
  385.     /**
  386.      * Remove glossaries
  387.      *
  388.      * @param \Notaris\AdminBundle\Entity\Glossary $glossaries
  389.      */
  390.     public function removeGlossary(\Notaris\AdminBundle\Entity\Glossary $glossaries)
  391.     {
  392.         $this->glossaries->removeElement($glossaries);
  393.     }
  394.     /**
  395.      * Get glossaries
  396.      *
  397.      * @return \Doctrine\Common\Collections\Collection
  398.      */
  399.     public function getGlossaries()
  400.     {
  401.         return $this->glossaries;
  402.     }
  403.     /**
  404.      * Add faqItems
  405.      *
  406.      * @param \Notaris\AdminBundle\Entity\Faq $faqItems
  407.      * @return Tag
  408.      */
  409.     public function addFaqItem(\Notaris\AdminBundle\Entity\Faq $faqItems)
  410.     {
  411.         $this->faqItems[] = $faqItems;
  412.         return $this;
  413.     }
  414.     /**
  415.      * Remove faqItems
  416.      *
  417.      * @param \Notaris\AdminBundle\Entity\Faq $faqItems
  418.      */
  419.     public function removeFaqItem(\Notaris\AdminBundle\Entity\Faq $faqItems)
  420.     {
  421.         $this->faqItems->removeElement($faqItems);
  422.     }
  423.     /**
  424.      * Get faqItems
  425.      *
  426.      * @return \Doctrine\Common\Collections\Collection
  427.      */
  428.     public function getFaqItems()
  429.     {
  430.         return $this->faqItems;
  431.     }
  432.     /**
  433.      * Add subsites
  434.      *
  435.      * @param \Notaris\AdminBundle\Entity\Subsite $subsites
  436.      * @return Tag
  437.      */
  438.     public function addSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
  439.     {
  440.         $this->subsites[] = $subsites;
  441.         return $this;
  442.     }
  443.     /**
  444.      * Remove subsites
  445.      *
  446.      * @param \Notaris\AdminBundle\Entity\Subsite $subsites
  447.      */
  448.     public function removeSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
  449.     {
  450.         $this->subsites->removeElement($subsites);
  451.     }
  452.     /**
  453.      * Get subsites
  454.      *
  455.      * @return \Doctrine\Common\Collections\Collection
  456.      */
  457.     public function getSubsites()
  458.     {
  459.         return $this->subsites;
  460.     }
  461.     /**
  462.      * Set description
  463.      *
  464.      * @param string $description
  465.      * @return Brochure
  466.      */
  467.     public function setDescription($description)
  468.     {
  469.         $this->description = $description;
  470.         return $this;
  471.     }
  472.     /**
  473.      * Get description
  474.      *
  475.      * @return string
  476.      */
  477.     public function getDescription()
  478.     {
  479.         return $this->description;
  480.     }
  481. }