2025-02-09 16:05:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use App\Repository\FestivalRepository;
|
2025-02-14 11:08:34 +01:00
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
2025-02-09 16:05:39 +01:00
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
#[ORM\Entity(repositoryClass: FestivalRepository::class)]
|
|
|
|
class Festival
|
|
|
|
{
|
|
|
|
#[ORM\Id]
|
|
|
|
#[ORM\GeneratedValue]
|
|
|
|
#[ORM\Column]
|
|
|
|
private ?int $id = null;
|
|
|
|
|
|
|
|
#[ORM\Column(length: 255)]
|
|
|
|
private ?string $name = null;
|
|
|
|
|
|
|
|
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
|
|
|
|
private ?\DateTimeInterface $date_start = null;
|
|
|
|
|
|
|
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
|
|
|
private ?\DateTimeInterface $date_end = null;
|
|
|
|
|
2025-02-14 11:08:34 +01:00
|
|
|
/**
|
|
|
|
* @var Collection<int, User>
|
|
|
|
*/
|
|
|
|
#[ORM\OneToMany(targetEntity: User::class, mappedBy: 'currentFestival')]
|
|
|
|
private Collection $users;
|
|
|
|
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'festivals')]
|
|
|
|
private ?User $user = null;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->users = new ArrayCollection();
|
|
|
|
}
|
|
|
|
|
2025-02-09 16:05:39 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDateStart(): ?\DateTimeInterface
|
|
|
|
{
|
|
|
|
return $this->date_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDateStart(?\DateTimeInterface $date_start): static
|
|
|
|
{
|
|
|
|
$this->date_start = $date_start;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDateEnd(): ?\DateTimeInterface
|
|
|
|
{
|
|
|
|
return $this->date_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDateEnd(\DateTimeInterface $date_end): static
|
|
|
|
{
|
|
|
|
$this->date_end = $date_end;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2025-02-14 11:08:34 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection<int, User>
|
|
|
|
*/
|
|
|
|
public function getUsers(): Collection
|
|
|
|
{
|
|
|
|
return $this->users;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addUser(User $user): static
|
|
|
|
{
|
|
|
|
if (!$this->users->contains($user)) {
|
|
|
|
$this->users->add($user);
|
|
|
|
$user->setCurrentFestival($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeUser(User $user): static
|
|
|
|
{
|
|
|
|
if ($this->users->removeElement($user)) {
|
|
|
|
// set the owning side to null (unless already changed)
|
|
|
|
if ($user->getCurrentFestival() === $this) {
|
|
|
|
$user->setCurrentFestival(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUser(): ?User
|
|
|
|
{
|
|
|
|
return $this->user;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUser(?User $user): static
|
|
|
|
{
|
|
|
|
$this->user = $user;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2025-02-09 16:05:39 +01:00
|
|
|
}
|