Advertisement
Guest User

Tag.php

a guest
May 29th, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.50 KB | None | 0 0
  1. <?php
  2.  
  3. namespace HardCoreMore\HRAPIBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7.  
  8. /**
  9.  * Tag
  10.  *
  11.  * @ORM\Table(name="tags")
  12.  * @ORM\Entity(repositoryClass="HardCoreMore\HRAPIBundle\Entity\TagRepository")
  13.  *
  14.  * @UniqueEntity(fields="name", message="Tag already exists")
  15.  */
  16. class Tag
  17. {
  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.     /**
  28.      * @var string
  29.      *
  30.      * @ORM\Column(name="name", type="string", length=127)
  31.      */
  32.     private $name;
  33.  
  34.     /**
  35.      *
  36.      * @ORM\ManyToMany(targetEntity="HumanResource")
  37.      * @ORM\JoinTable(name="human_resource_tags",
  38.      *      joinColumns={@ORM\JoinColumn(name="tag_id", referencedColumnName="id")},
  39.      *      inverseJoinColumns={@ORM\JoinColumn(name="human_resource_id", referencedColumnName="id")}
  40.      *      )
  41.      */
  42.     protected $human_resources;
  43.  
  44.     /**
  45.      * Get id
  46.      *
  47.      * @return integer
  48.      */
  49.     public function getId()
  50.     {
  51.         return $this->id;
  52.     }
  53.  
  54.     /**
  55.      * Set name
  56.      *
  57.      * @param string $name
  58.      * @return Tag
  59.      */
  60.     public function setName($name)
  61.     {
  62.         $this->name = $name;
  63.  
  64.         return $this;
  65.     }
  66.  
  67.     /**
  68.      * Get name
  69.      *
  70.      * @return string
  71.      */
  72.     public function getName()
  73.     {
  74.         return $this->name;
  75.     }
  76.     /**
  77.      * Constructor
  78.      */
  79.     public function __construct()
  80.     {
  81.         $this->human_resources = new \Doctrine\Common\Collections\ArrayCollection();
  82.     }
  83.  
  84.     /**
  85.      * Add humanResources
  86.      *
  87.      * @param \HardCoreMore\HRAPIBundle\Entity\HumanResource $humanResources
  88.      * @return Tag
  89.      */
  90.     public function addHumanResource(\HardCoreMore\HRAPIBundle\Entity\HumanResource $humanResource)
  91.     {
  92.         $this->human_resources[] = $humanResource;
  93.  
  94.         return $this;
  95.     }
  96.  
  97.     /**
  98.      * Remove humanResources
  99.      *
  100.      * @param \HardCoreMore\HRAPIBundle\Entity\HumanResource $humanResources
  101.      */
  102.     public function removeHumanResource(\HardCoreMore\HRAPIBundle\Entity\HumanResource $humanResource)
  103.     {
  104.         $this->human_resources->removeElement($humanResource);
  105.     }
  106.  
  107.     /**
  108.      * Get humanResources
  109.      *
  110.      * @return \Doctrine\Common\Collections\Collection
  111.      */
  112.     public function getHumanResources()
  113.     {
  114.         return $this->human_resources;
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement