src/Entity/ImageTextGrid.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\Traits\ActiveTrait;
  5. use App\Entity\Traits\DeleteTrait;
  6. use App\Entity\Traits\SubTitleTrait;
  7. use App\Entity\Traits\TranslateTrait;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use App\Entity\Traits\ImageUploadTrait;
  10. use App\Entity\Interfaces\DefaultEntity;
  11. use App\Entity\Traits\TitleAndContentTrait;
  12. use App\Repository\ImageTextGridRepository;
  13. use Doctrine\Common\Collections\Collection;
  14. use App\Entity\Traits\ThirdImageUploadTrait;
  15. use App\Entity\Traits\FourthImageUploadTrait;
  16. use App\Entity\Traits\SecondImageUploadTrait;
  17. use Doctrine\Common\Collections\ArrayCollection;
  18. use Gedmo\Timestampable\Traits\TimestampableEntity;
  19. use App\Entity\Traits\SortOrderTrait;
  20. /**
  21.  * @Gedmo\Loggable
  22.  */
  23. #[ORM\Entity(repositoryClassImageTextGridRepository::class)]
  24. class ImageTextGrid implements DefaultEntity
  25. {
  26.     use TitleAndContentTrait;
  27.     use SubTitleTrait;
  28.     use ImageUploadTrait;
  29.     use SecondImageUploadTrait;
  30.     use ThirdImageUploadTrait;
  31.     use FourthImageUploadTrait;
  32.     use ActiveTrait;
  33.     use DeleteTrait;
  34.     use SortOrderTrait;
  35.     use TimestampableEntity;
  36.     use TranslateTrait;
  37.     #[ORM\Id]
  38.     #[ORM\GeneratedValue]
  39.     #[ORM\Column(type:"integer")]
  40.     private $id;
  41.     #[ORM\ManyToMany(targetEntityPage::class, mappedBy'imageTextGrids')]
  42.     private $pages;
  43.     public function __construct()
  44.     {
  45.         $this->pages = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     /**
  52.      * @return Collection<int, Page>
  53.      */
  54.     public function getPages(): Collection
  55.     {
  56.         return $this->pages;
  57.     }
  58.     public function addPage(Page $page): self
  59.     {
  60.         if (!$this->pages->contains($page)) {
  61.             $this->pages[] = $page;
  62.             $page->addImageTextGrid($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removePage(Page $page): self
  67.     {
  68.         $this->pages->removeElement($page);
  69.         $page->removeImageTextGrid($this);
  70.         return $this;
  71.     }
  72. }