<?phpnamespace App\Entity;use App\Repository\RecipeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RecipeRepository::class)]class Recipe{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'recipe')] private Collection $products; #[ORM\ManyToMany(targetEntity: Session::class, mappedBy: 'recipes')] private Collection $sessions; public function __construct() { $this->products = new ArrayCollection(); $this->sessions = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection<int, Product> */ public function getProducts(): Collection { return $this->products; } public function addProduct(Product $product): self { if (!$this->products->contains($product)) { $this->products->add($product); $product->addRecipe($this); } return $this; } public function removeProduct(Product $product): self { if ($this->products->removeElement($product)) { $product->removeRecipe($this); } return $this; } /** * @return Collection<int, Session> */ public function getSessions(): Collection { return $this->sessions; } public function addSession(Session $session): self { if (!$this->sessions->contains($session)) { $this->sessions->add($session); $session->addRecipe($this); } return $this; } public function removeSession(Session $session): self { if ($this->sessions->removeElement($session)) { $session->removeRecipe($this); } return $this; }}