Files
EXO_GDP/src/Entity/Plat.php
T
2025-01-09 09:22:39 +04:00

122 lines
2.3 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\PlatRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PlatRepository::class)]
class Plat
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column]
private ?float $prix = null;
#[ORM\ManyToOne(inversedBy: 'plats')]
private ?categorie $categorie = null;
/**
* @var Collection<int, Menu>
*/
#[ORM\ManyToMany(targetEntity: Menu::class, mappedBy: 'plats')]
private Collection $menus;
public function __construct()
{
$this->menus = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getPrix(): ?float
{
return $this->prix;
}
public function setPrix(float $prix): static
{
$this->prix = $prix;
return $this;
}
public function getCategorie(): ?categorie
{
return $this->categorie;
}
public function setCategorie(?categorie $categorie): static
{
$this->categorie = $categorie;
return $this;
}
/**
* @return Collection<int, Menu>
*/
public function getMenus(): Collection
{
return $this->menus;
}
public function addMenu(Menu $menu): static
{
if (!$this->menus->contains($menu)) {
$this->menus->add($menu);
$menu->addPlat($this);
}
return $this;
}
public function removeMenu(Menu $menu): static
{
if ($this->menus->removeElement($menu)) {
$menu->removePlat($this);
}
return $this;
}
}