<?php
/**
* Created by PhpStorm.
* User: lisavandaele
* Date: 30/01/15
* Time: 12:53
*/
namespace Notaris\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="TagRepository")
* @ORM\Table(name="tag",uniqueConstraints={
* @ORM\UniqueConstraint(name="unique_tag", columns={"name", "locale"})})
*/
class Tag {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
* @Assert\Type("string")
* @Assert\NotBlank()
*/
private $name;
/**
* @ORM\Column(type="text", name="description", nullable=true)
*/
private $description;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=5)
*/
private $locale;
/**
* @var integer
*
* @ORM\Column(type="integer", name="count_clicked")
*/
private $countClicked = 0;
/**
* @ORM\ManyToMany(targetEntity="Subsite")
* @ORM\JoinTable(name="tag_subsite")
* @ORM\OrderBy({"position" = "asc"})
*/
protected $subsites;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created", type="datetime")
*/
private $created;
/**
* @ORM\Column(name="updated", type="datetime")
* @Gedmo\Timestampable(on="update")
*/
private $updated;
/**
* @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $user;
/**
* @ORM\ManyToMany(targetEntity="Video", mappedBy="tags")
*/
protected $videos;
/**
* @ORM\ManyToMany(targetEntity="Section", mappedBy="tags")
*/
protected $sections;
/**
* @ORM\ManyToMany(targetEntity="News", mappedBy="tags")
*/
protected $newsitems;
/**
* @ORM\ManyToMany(targetEntity="Brochure", mappedBy="tags")
*/
protected $brochures;
/**
* @ORM\ManyToMany(targetEntity="Glossary", mappedBy="tags")
*/
protected $glossaries;
/**
* @ORM\ManyToMany(targetEntity="Faq", mappedBy="tags")
*/
protected $faqItems;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Tag
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set locale
*
* @param string $locale
* @return Tag
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Set countClicked
*
* @param integer $countClicked
* @return Tag
*/
public function setCountClicked($countClicked)
{
$this->countClicked = $countClicked;
return $this;
}
/**
* Get countClicked
*
* @return integer
*/
public function getCountClicked()
{
return $this->countClicked;
}
/**
* Set created
*
* @param \DateTime $created
* @return Tag
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param \DateTime $updated
* @return Tag
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set user
*
* @param \Notaris\AdminBundle\Entity\User $user
* @return Tag
*/
public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Notaris\AdminBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set slug
*
* @param string $slug
* @return Tag
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Constructor
*/
public function __construct()
{
$this->videos = new \Doctrine\Common\Collections\ArrayCollection();
$this->sections = new \Doctrine\Common\Collections\ArrayCollection();
$this->newsitems = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add videos
*
* @param \Notaris\AdminBundle\Entity\Video $videos
* @return Tag
*/
public function addVideo(\Notaris\AdminBundle\Entity\Video $videos)
{
$this->videos[] = $videos;
return $this;
}
/**
* Remove videos
*
* @param \Notaris\AdminBundle\Entity\Video $videos
*/
public function removeVideo(\Notaris\AdminBundle\Entity\Video $videos)
{
$this->videos->removeElement($videos);
}
/**
* Get videos
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getVideos()
{
return $this->videos;
}
/**
* Add sections
*
* @param \Notaris\AdminBundle\Entity\Section $sections
* @return Tag
*/
public function addSection(\Notaris\AdminBundle\Entity\Section $sections)
{
$this->sections[] = $sections;
return $this;
}
/**
* Remove sections
*
* @param \Notaris\AdminBundle\Entity\Section $sections
*/
public function removeSection(\Notaris\AdminBundle\Entity\Section $sections)
{
$this->sections->removeElement($sections);
}
/**
* Get sections
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSections()
{
return $this->sections;
}
/**
* Add newsitems
*
* @param \Notaris\AdminBundle\Entity\News $newsitems
* @return Tag
*/
public function addNewsitem(\Notaris\AdminBundle\Entity\News $newsitems)
{
$this->newsitems[] = $newsitems;
return $this;
}
/**
* Remove newsitems
*
* @param \Notaris\AdminBundle\Entity\News $newsitems
*/
public function removeNewsitem(\Notaris\AdminBundle\Entity\News $newsitems)
{
$this->newsitems->removeElement($newsitems);
}
/**
* Get newsitems
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNewsitems()
{
return $this->newsitems;
}
/**
* Add brochures
*
* @param \Notaris\AdminBundle\Entity\Brochure $brochures
* @return Tag
*/
public function addBrochure(\Notaris\AdminBundle\Entity\Brochure $brochures)
{
$this->brochures[] = $brochures;
return $this;
}
/**
* Remove brochures
*
* @param \Notaris\AdminBundle\Entity\Brochure $brochures
*/
public function removeBrochure(\Notaris\AdminBundle\Entity\Brochure $brochures)
{
$this->brochures->removeElement($brochures);
}
/**
* Get brochures
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getBrochures()
{
return $this->brochures;
}
/**
* Add glossaries
*
* @param \Notaris\AdminBundle\Entity\Glossary $glossaries
* @return Tag
*/
public function addGlossary(\Notaris\AdminBundle\Entity\Glossary $glossaries)
{
$this->glossaries[] = $glossaries;
return $this;
}
/**
* Remove glossaries
*
* @param \Notaris\AdminBundle\Entity\Glossary $glossaries
*/
public function removeGlossary(\Notaris\AdminBundle\Entity\Glossary $glossaries)
{
$this->glossaries->removeElement($glossaries);
}
/**
* Get glossaries
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGlossaries()
{
return $this->glossaries;
}
/**
* Add faqItems
*
* @param \Notaris\AdminBundle\Entity\Faq $faqItems
* @return Tag
*/
public function addFaqItem(\Notaris\AdminBundle\Entity\Faq $faqItems)
{
$this->faqItems[] = $faqItems;
return $this;
}
/**
* Remove faqItems
*
* @param \Notaris\AdminBundle\Entity\Faq $faqItems
*/
public function removeFaqItem(\Notaris\AdminBundle\Entity\Faq $faqItems)
{
$this->faqItems->removeElement($faqItems);
}
/**
* Get faqItems
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getFaqItems()
{
return $this->faqItems;
}
/**
* Add subsites
*
* @param \Notaris\AdminBundle\Entity\Subsite $subsites
* @return Tag
*/
public function addSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
{
$this->subsites[] = $subsites;
return $this;
}
/**
* Remove subsites
*
* @param \Notaris\AdminBundle\Entity\Subsite $subsites
*/
public function removeSubsite(\Notaris\AdminBundle\Entity\Subsite $subsites)
{
$this->subsites->removeElement($subsites);
}
/**
* Get subsites
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSubsites()
{
return $this->subsites;
}
/**
* Set description
*
* @param string $description
* @return Brochure
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
}