Advertisement
Guest User

Untitled

a guest
Oct 31st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.38 KB | None | 0 0
  1. <?php
  2. namespace FermierMalin\Bundle\GrowerBundle\Entity;
  3.  
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7.  
  8. /**
  9.  * @ORM\Entity (repositoryClass="FermierMalin\Bundle\GrowerBundle\Entity\CategoryGrowerRepository")
  10.  * @ORM\Table (name="category_grower")
  11.  */
  12. class CategoryGrower
  13. {
  14.     public function __construct() {
  15.         $this->growers = new ArrayCollection();
  16.     }
  17.  
  18.     public function __toString()
  19.     {
  20.         return $this->getLabel();
  21.     }
  22.  
  23.     /**
  24.      * @ORM\Id
  25.      * @ORM\Column(type="integer")
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      */
  28.     private $id;
  29.  
  30.     /**
  31.      * @ORM\Column(name="label", type="string")
  32.      */
  33.     private $label;
  34.  
  35.     /**
  36.      * @ORM\Column(name="parent", type="string")
  37.      */
  38.     private $parent;
  39.  
  40.     /**
  41.      * @ORM\OneToMany(targetEntity="Grower", mappedBy="category")
  42.      **/
  43.     private $growers;
  44.  
  45.     /**
  46.      * Get id
  47.      *
  48.      * @return integer
  49.      */
  50.     public function getId()
  51.     {
  52.         return $this->id;
  53.     }
  54.  
  55.     /**
  56.      * Set label
  57.      *
  58.      * @param string $label
  59.      * @return CategoryGrower
  60.      */
  61.     public function setLabel($label)
  62.     {
  63.         $this->label = $label;
  64.  
  65.         return $this;
  66.     }
  67.  
  68.     /**
  69.      * Get label
  70.      *
  71.      * @return string
  72.      */
  73.     public function getLabel()
  74.     {
  75.         return $this->label;
  76.     }
  77.  
  78.     /**
  79.      * Set parent
  80.      *
  81.      * @param string $parent
  82.      * @return CategoryGrower
  83.      */
  84.     public function setParent($parent)
  85.     {
  86.         $this->parent = $parent;
  87.  
  88.         return $this;
  89.     }
  90.  
  91.     /**
  92.      * Get parent
  93.      *
  94.      * @return string
  95.      */
  96.     public function getParent()
  97.     {
  98.         return $this->parent;
  99.     }
  100.  
  101.     /**
  102.      * Add growers
  103.      *
  104.      * @param Grower $growers
  105.      * @return CategoryGrower
  106.      */
  107.     public function addGrower(Grower $growers)
  108.     {
  109.         $this->growers[] = $growers;
  110.  
  111.         return $this;
  112.     }
  113.  
  114.     /**
  115.      * Remove growers
  116.      *
  117.      * @param Grower $growers
  118.      */
  119.     public function removeGrower(Grower $growers)
  120.     {
  121.         $this->growers->removeElement($growers);
  122.     }
  123.  
  124.     /**
  125.      * Get growers
  126.      *
  127.      * @return Collection
  128.      */
  129.     public function getGrowers()
  130.     {
  131.         return $this->growers;
  132.     }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement