<?php
namespace App\Entity;
use App\Repository\PreparationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PreparationRepository::class)]
class Preparation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string',length: 255)]
private $libelle;
#[ORM\Column(type: 'string',length: 255, nullable: true)]
private $description;
#[ORM\Column(type: 'string',length: 255, nullable: true)]
private $img;
#[ORM\OneToMany(mappedBy: 'preparation', targetEntity: Ingredient::class, orphanRemoval: true)]
private $ingredients;
#[ORM\ManyToOne(targetEntity: Categorie::class, inversedBy:'preparations')]
private $categorie;
#[ORM\OneToMany(mappedBy: 'preparation', targetEntity: LigneCommande::class, orphanRemoval: true)]
private $lignesCommande;
#[ORM\OneToMany(mappedBy: 'preparation', targetEntity: Menu::class, orphanRemoval: true)]
private $menus;
#[ORM\ManyToOne(targetEntity:Foodtruck::class, inversedBy: 'preparations')]
private $foodtruck;
public function __toString()
{
return $this->libelle;
}
public function __construct()
{
$this->ingredients = new ArrayCollection();
$this->lignesCommande = new ArrayCollection();
$this->menus = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getImg(): ?string
{
return $this->img;
}
public function setImg(?string $img): self
{
$this->img = $img;
return $this;
}
/**
* @return Collection|Ingredient[]
*/
public function getIngredients(): Collection
{
return $this->ingredients;
}
public function addIngredient(Ingredient $ingredient): self
{
if (!$this->ingredients->contains($ingredient)) {
$this->ingredients[] = $ingredient;
$ingredient->setPreparation($this);
}
return $this;
}
public function removeIngredient(Ingredient $ingredient): self
{
if ($this->ingredients->removeElement($ingredient)) {
// set the owning side to null (unless already changed)
if ($ingredient->getPreparation() === $this) {
$ingredient->setPreparation(null);
}
}
return $this;
}
public function getCategorie(): ?Categorie
{
return $this->categorie;
}
public function setCategorie(?Categorie $categorie): self
{
$this->categorie = $categorie;
return $this;
}
/**
* @return Collection|LigneCommande[]
*/
public function getLignesCommande(): Collection
{
return $this->lignesCommande;
}
public function addLignesCommande(LigneCommande $lignesCommande): self
{
if (!$this->lignesCommande->contains($lignesCommande)) {
$this->lignesCommande[] = $lignesCommande;
$lignesCommande->setPreparation($this);
}
return $this;
}
public function removeLignesCommande(LigneCommande $lignesCommande): self
{
if ($this->lignesCommande->removeElement($lignesCommande)) {
// set the owning side to null (unless already changed)
if ($lignesCommande->getPreparation() === $this) {
$lignesCommande->setPreparation(null);
}
}
return $this;
}
/**
* @return Collection<int, Menu>
*/
public function getMenus(): Collection
{
return $this->menus;
}
public function addMenu(Menu $menu): self
{
if (!$this->menus->contains($menu)) {
$this->menus->add($menu);
$menu->setPreparation($this);
}
return $this;
}
public function removeMenu(Menu $menu): self
{
if ($this->menus->removeElement($menu)) {
// set the owning side to null (unless already changed)
if ($menu->getPreparation() === $this) {
$menu->setPreparation(null);
}
}
return $this;
}
public function getFoodtruck(): ?Foodtruck
{
return $this->foodtruck;
}
public function setFoodtruck(?Foodtruck $foodtruck): self
{
$this->foodtruck = $foodtruck;
return $this;
}
}