Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Gallery Model:
- <?php
- namespace Foo\Bar\Domain\Model;
- use TYPO3\Flow\Annotations as Flow;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * A gallery
- *
- * @Flow\Entity
- */
- class Gallery {
- /**
- * The images of this gallery
- *
- * @var \Doctrine\Common\Collections\Collection<\Foo\Bar\Domain\Model\Image>
- * @ORM\OneToMany(mappedBy="gallery", cascade={"all"}, orphanRemoval=true)
- */
- protected $images;
- public function __construct() {
- $this->images = new \Doctrine\Common\Collections\ArrayCollection();
- }
- ....
- }
- ?>
- Image Model:
- <?php
- namespace Foo\Bar\Domain\Model;
- use TYPO3\Flow\Annotations as Flow;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @Flow\Entity
- */
- class Image extends \TYPO3\Media\Domain\Model\Image {
- /**
- * The gallery this image belongs to
- *
- * @var \Foo\Bar\Domain\Model\Gallery
- * @ORM\ManyToOne(inversedBy="images")
- * @ORM\Column(nullable=true)
- */
- protected $gallery;
- /**
- * @return object
- */
- public function getGallery() {
- return $this->gallery;
- }
- /**
- * @param $gallery
- * @return void
- */
- public function setGallery($gallery) {
- $this->gallery = $gallery;
- }
- ...
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment