<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\HomeImageRepository;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Entity(repositoryClass: HomeImageRepository::class)]
class HomeImage
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $title = null;
#[ORM\Column(nullable: true)]
private ?bool $isEnable = null;
#[ORM\Column(nullable: true)]
private ?bool $accueil = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $deletedAt = null;
#[ORM\OneToMany(mappedBy: 'homeImage', targetEntity: Media::class)]
private Collection $medias;
public function __construct()
{
// $this->medias = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): static
{
$this->title = $title;
return $this;
}
public function isIsEnable(): ?bool
{
return $this->isEnable;
}
public function setIsEnable(?bool $isEnable): static
{
$this->isEnable = $isEnable;
return $this;
}
public function isAccueil(): ?bool
{
return $this->accueil;
}
public function setAccueil(?bool $accueil): static
{
$this->accueil = $accueil;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): static
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* @return Collection<int, Media>
*/
public function getMedias(): Collection
{
return $this->medias;
}
public function addMedia(Media $media): static
{
if (!$this->medias->contains($media)) {
$this->medias->add($media);
$media->setHomeImage($this);
}
return $this;
}
public function removeMedia(Media $media): static
{
if ($this->medias->removeElement($media)) {
// set the owning side to null (unless already changed)
if ($media->getHomeImage() === $this) {
$media->setHomeImage(null);
}
}
return $this;
}
}