The recipes */ #[ORM\OneToMany(targetEntity: OutputRecipeMaterial::class, mappedBy: 'material', orphanRemoval: true)] #[Assert\Valid] private Collection $recipes; /** * Initialization */ public function __construct () { $this->recipes = new ArrayCollection(); } /** * The type * * @return MaterialType|null The type */ public function getType (): ?MaterialType { return $this->type; } /** * Set the type * * @param MaterialType|null $type The type * * @return $this */ public function setType (?MaterialType $type): static { $this->type = $type; return $this; } /** * Is the material craftable by default? * * @return bool|null Is the material craftable by default? */ public function isCraftableByDefault (): ?bool { return $this->isCraftableByDefault; } /** * Set if the material craftable by default * * @param bool $isCraftableByDefault Is the material craftable by default? * * @return $this */ public function setIsCraftableByDefault (bool $isCraftableByDefault): static { $this->isCraftableByDefault = $isCraftableByDefault; return $this; } /** * The recipes * * @return Collection The recipes */ public function getRecipes (): Collection { return $this->recipes; } /** * Add a recipe * * @param OutputRecipeMaterial $recipe The recipe * * @return $this */ public function addRecipe (OutputRecipeMaterial $recipe): static { if (!$this->recipes->contains($recipe)) { $this->recipes->add($recipe); $recipe->setMaterial($this); } return $this; } /** * Remove a recipe * * @param OutputRecipeMaterial $recipe The recipe * * @return $this */ public function removeRecipe (OutputRecipeMaterial $recipe): static { if ($this->recipes->removeElement($recipe)) { // set the owning side to null (unless already changed) if ($recipe->getMaterial() === $this) { $recipe->setMaterial(null); } } return $this; } }