Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.95 KB | None | 0 0
  1. <?php
  2.  
  3. namespace My\Bundle\Entity\Post;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6.  
  7. /**
  8.  * Gallery
  9.  *
  10.  * @ORM\Table()
  11.  * @ORM\Entity
  12.  */
  13. class Gallery
  14. {
  15.     /**
  16.      * @var integer
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.  
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="name", type="string", length=255)
  28.      */
  29.     private $name;
  30.  
  31.     /**
  32.      * @ORM\OneToMany(targetEntity="GalleryImage", mappedBy="gallery", cascade={"persist"})
  33.      */
  34.     private $images;
  35.  
  36.     /**
  37.      * Get id
  38.      *
  39.      * @return integer
  40.      */
  41.     public function getId()
  42.     {
  43.         return $this->id;
  44.     }
  45.  
  46.     /**
  47.      * Set name
  48.      *
  49.      * @param string $name
  50.      * @return Gallery
  51.      */
  52.     public function setName($name)
  53.     {
  54.         $this->name = $name;
  55.  
  56.         return $this;
  57.     }
  58.  
  59.     /**
  60.      * Get name
  61.      *
  62.      * @return string
  63.      */
  64.     public function getName()
  65.     {
  66.         return $this->name;
  67.     }
  68.     /**
  69.      * Constructor
  70.      */
  71.     public function __construct()
  72.     {
  73.         $this->images = new \Doctrine\Common\Collections\ArrayCollection();
  74.     }
  75.  
  76.     /**
  77.      * Add images
  78.      *
  79.      * @param \My\Bundle\Entity\Post\GalleryImage $images
  80.      * @return Gallery
  81.      */
  82.     public function addImage(\My\Bundle\Entity\Post\GalleryImage $images)
  83.     {
  84.         $this->images[] = $images;
  85.         $images->setGallery($this);
  86.  
  87.         return $this;
  88.     }
  89.  
  90.     /**
  91.      * Remove images
  92.      *
  93.      * @param \My\Bundle\Entity\Post\GalleryImage $images
  94.      */
  95.     public function removeImage(\My\Bundle\Entity\Post\GalleryImage $images)
  96.     {
  97.         $this->images->removeElement($images);
  98.     }
  99.  
  100.     /**
  101.      * Get images
  102.      *
  103.      * @return \Doctrine\Common\Collections\Collection
  104.      */
  105.     public function getImages()
  106.     {
  107.         return $this->images;
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement