caisse-bliss/src/Entity/SerieFestival.php
2025-02-14 14:35:21 +01:00

111 lines
2.4 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\SerieFestivalRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiResource;
#[ApiResource(paginationEnabled: false)]
#[ORM\Entity(repositoryClass: SerieFestivalRepository::class)]
class SerieFestival
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
/**
* @var Collection<int, Festival>
*/
#[ORM\OneToMany(targetEntity: Festival::class, mappedBy: 'serieFestival')]
private Collection $festivals;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $dateCreation = null;
#[ORM\ManyToOne(inversedBy: 'seriesFestival')]
private ?User $user = null;
public function __construct()
{
$this->festivals = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Festival>
*/
public function getFestivals(): Collection
{
return $this->festivals;
}
public function addFestival(Festival $festival): static
{
if (!$this->festivals->contains($festival)) {
$this->festivals->add($festival);
$festival->setSerieFestival($this);
}
return $this;
}
public function removeFestival(Festival $festival): static
{
if ($this->festivals->removeElement($festival)) {
// set the owning side to null (unless already changed)
if ($festival->getSerieFestival() === $this) {
$festival->setSerieFestival(null);
}
}
return $this;
}
public function getDateCreation(): ?\DateTimeInterface
{
return $this->dateCreation;
}
public function setDateCreation(\DateTimeInterface $dateCreation): static
{
$this->dateCreation = $dateCreation;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
}