src/Entity/Webfactory/Widget/Classique/Gallery.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Webfactory\Widget\Classique;
  3. use App\Entity\Image\Image;
  4. use App\Entity\Webfactory\WebfactoryPage;
  5. use App\Entity\Webfactory\Widget\WidgetAbstract;
  6. use App\Repository\Webfactory\Widget\Classique\GalleryRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Table('widget_gallery_classique')]
  11. #[ORM\Entity(repositoryClassGalleryRepository::class)]
  12. class Gallery extends WidgetAbstract
  13. {
  14.     #[ORM\Column(type'datetime_immutable')]
  15.     private $created_at;
  16.     #[ORM\JoinTable(name'widget_gallery_images_classique')]
  17.     #[ORM\ManyToMany(targetEntityImage::class, inversedBy'galleries')]
  18.     private $images;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $typeAffichagePhotos null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?int $sliderSlideToShow null;
  23.     public function __construct(){
  24.         $this->created_at = new \DateTimeImmutable("now");
  25.         $this->images = new ArrayCollection();
  26.     }
  27.     public function getCreatedAt(): ?\DateTimeImmutable
  28.     {
  29.         return $this->created_at;
  30.     }
  31.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  32.     {
  33.         $this->created_at $created_at;
  34.         return $this;
  35.     }
  36.     /**
  37.      * @return Collection|Image[]
  38.      */
  39.     public function getImages(): Collection
  40.     {
  41.         return $this->images;
  42.     }
  43.     public function addImage(Image $image): self
  44.     {
  45.         if (!$this->images->contains($image)) {
  46.             $this->images[] = $image;
  47.         }
  48.         return $this;
  49.     }
  50.     public function removeImage(Image $image): self
  51.     {
  52.         $this->images->removeElement($image);
  53.         return $this;
  54.     }
  55.     public function getTypeAffichagePhotos(): ?string
  56.     {
  57.         return $this->typeAffichagePhotos;
  58.     }
  59.     public function setTypeAffichagePhotos(?string $typeAffichagePhotos): static
  60.     {
  61.         $this->typeAffichagePhotos $typeAffichagePhotos;
  62.         return $this;
  63.     }
  64.     public function getSliderSlideToShow(): ?int
  65.     {
  66.         return $this->sliderSlideToShow;
  67.     }
  68.     public function setSliderSlideToShow(?int $sliderSlideToShow): static
  69.     {
  70.         $this->sliderSlideToShow $sliderSlideToShow;
  71.         return $this;
  72.     }
  73. }