mise en place des entity + mise en place du projet
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\MenuRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MenuRepository::class)]
|
||||
class Menu
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $nom = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $dateDeCreation = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, plat>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: plat::class, inversedBy: 'menus')]
|
||||
private Collection $plats;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'menus')]
|
||||
private ?Restaurant $restaurant = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->plats = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getNom(): ?string
|
||||
{
|
||||
return $this->nom;
|
||||
}
|
||||
|
||||
public function setNom(string $nom): static
|
||||
{
|
||||
$this->nom = $nom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateDeCreation(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateDeCreation;
|
||||
}
|
||||
|
||||
public function setDateDeCreation(\DateTimeImmutable $dateDeCreation): static
|
||||
{
|
||||
$this->dateDeCreation = $dateDeCreation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, plat>
|
||||
*/
|
||||
public function getPlats(): Collection
|
||||
{
|
||||
return $this->plats;
|
||||
}
|
||||
|
||||
public function addPlat(plat $plat): static
|
||||
{
|
||||
if (!$this->plats->contains($plat)) {
|
||||
$this->plats->add($plat);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePlat(plat $plat): static
|
||||
{
|
||||
$this->plats->removeElement($plat);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRestaurant(): ?Restaurant
|
||||
{
|
||||
return $this->restaurant;
|
||||
}
|
||||
|
||||
public function setRestaurant(?Restaurant $restaurant): static
|
||||
{
|
||||
$this->restaurant = $restaurant;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user