<?php
namespace App\Entity;
use App\Repository\UtensilRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UtensilRepository::class)]
class Utensil
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $prix = null;
#[ORM\ManyToOne(inversedBy: 'utensils')]
private ?ProductType $productType = null;
#[ORM\ManyToMany(targetEntity: Recipe::class, inversedBy: 'utensils')]
private Collection $recipe;
public function __construct()
{
$this->recipe = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getPrix(): ?string
{
return $this->prix;
}
public function setPrix(?string $prix): self
{
$this->prix = $prix;
return $this;
}
public function getProductType(): ?productType
{
return $this->productType;
}
public function setProductType(?productType $productType): self
{
$this->productType = $productType;
return $this;
}
/**
* @return Collection<int, Recipe>
*/
// public function getRecipe(): Collection
// {
// return $this->recipe;
// }
public function addRecipe(Recipe $recipe): self
{
if (!$this->recipe->contains($recipe)) {
$this->recipe->add($recipe);
}
return $this;
}
public function removeRecipe(Recipe $recipe): self
{
$this->recipe->removeElement($recipe);
return $this;
}
}