|
- <?php
-
- namespace App\Entity\Site;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
- use App\Entity\File\File;
- use Lc\SovBundle\Repository\Site\PageRepository;
-
- /**
- * @ORM\Entity(repositoryClass=PageRepository::class)
- */
- class Page extends AbstractFullEntity
- {
- /**
- * @ORM\Id
- * @ORM\GeneratedValue
- * @ORM\Column(type="integer")
- */
- private $id;
-
- /**
- * @ORM\ManyToOne(targetEntity=File::class, cascade={"persist", "remove"})
- */
- private $image;
-
- /**
- * @ORM\ManyToMany(targetEntity=File::class, cascade={"persist", "remove"}, orphanRemoval=true)
- * @ORM\OrderBy({"position" = "ASC"})
- */
- private $gallery;
-
- /**
- * @ORM\ManyToOne(targetEntity=File::class, cascade={"persist"})
- */
- private $file;
-
- public function __construct()
- {
- $this->gallery = new ArrayCollection();
- }
-
- public function __toString()
- {
- return $this->title;
- }
-
- public function getId(): ?int
- {
- return $this->id;
- }
-
- public function getImage(): ?File
- {
- return $this->image;
- }
-
- public function setImage(?File $image): self
- {
- $this->image = $image;
-
- return $this;
- }
-
- /**
- * @return Collection|File[]
- */
- public function getGallery(): Collection
- {
- return $this->gallery;
- }
-
- public function addGallery(File $gallery): self
- {
- if (!$this->gallery->contains($gallery)) {
- $this->gallery[] = $gallery;
- }
-
- return $this;
- }
-
- public function removeGallery(File $gallery): self
- {
- $this->gallery->removeElement($gallery);
-
- return $this;
- }
-
- public function getFile(): ?File
- {
- return $this->file;
- }
-
- public function setFile(?File $file): self
- {
- $this->file = $file;
-
- return $this;
- }
-
- }
|