Guest User

Untitled

a guest
Sep 8th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. Form:
  2. <f:form.upload property="images" id="images" additionalAttributes="{multiple:multiple}" />
  3.  
  4. Model:
  5.     /**
  6.      * The images of this gallery
  7.      *
  8.      * @var \Doctrine\Common\Collections\Collection<\Foo\Bar\Domain\Model\Image>
  9.      * @ORM\OneToMany(mappedBy="gallery", cascade={"all"}, orphanRemoval=true)
  10.      */  
  11.     protected $images;  
  12.  
  13.     /**
  14.      * Returns all content belonging to this page
  15.      *
  16.      * @return \Doctrine\Common\Collections\Collection<\Foo\Bar\Domain\Model\Image> image
  17.      */
  18.     public function getImages() {
  19.         return $this->images;
  20.     }
  21.  
  22.     /**
  23.      * @param \Doctrine\Common\Collections\Collection $images
  24.      * @return void
  25.      */
  26.     public function setImages(\Doctrine\Common\Collections\Collection $images) {
  27.         $this->images = $images;
  28.     }
  29.      
  30.     /**
  31.      * @param \Foo\Bar\Domain\Model\Image $image
  32.      * @return void
  33.      */
  34.     public function addImage(\Foo\Bar\Domain\Model\Image$image) {
  35.     $this->images->add($image);
  36.     }  
  37.  
  38.     /**
  39.      * @param \Foo\Bar\Domain\Model\Image $image
  40.      * @return void
  41.      */
  42.     public function removeImage(\Foo\Bar\Domain\Model\Image$image) {
  43.         $this->images->removeElement($image);
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment