<?phpnamespace App\Entity\Recipe;use App\Repository\Recipe\RecipeIngredientRepository;use ApiPlatform\Core\Annotation\ApiResource;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ApiResource( * attributes={ * "order"={"position": "ASC"} * }, * ) * * @ORM\Entity(repositoryClass=RecipeIngredientRepository::class) */class RecipeIngredient{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Recipe::class, inversedBy="recipeIngredients") * @ORM\JoinColumn(nullable=false) */ private $recipe; /** * @ORM\ManyToOne(targetEntity=Ingredient::class, inversedBy="recipeIngredients") * @ORM\JoinColumn(nullable=false) * @Groups({ * "Recipe:io", * }) */ private $ingredient; /** * @ORM\ManyToOne(targetEntity=IngredientMeasureUnit::class) * @Groups({ * "Recipe:io", * }) */ private $measureUnit; /** * @ORM\Column(type="float") * @Groups({ * "Recipe:io", * }) */ private $quantity; /** * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @Groups({ * "Recipe:io", * }) */ private ?int $position = 1; public function getId(): ?int { return $this->id; } public function getRecipe(): ?Recipe { return $this->recipe; } public function setRecipe(?Recipe $recipe): self { $this->recipe = $recipe; return $this; } public function getIngredient(): ?Ingredient { return $this->ingredient; } public function setIngredient(?Ingredient $ingredient): self { $this->ingredient = $ingredient; return $this; } public function getMeasureUnit(): ?IngredientMeasureUnit { return $this->measureUnit; } public function setMeasureUnit(?IngredientMeasureUnit $measureUnit): self { $this->measureUnit = $measureUnit; return $this; } public function getQuantity(): ?float { return $this->quantity; } public function setQuantity(float $quantity): self { $this->quantity = $quantity; return $this; } public function getPosition(): ?int { return $this->position; } public function setPosition(int $position): self { $this->position = $position; return $this; }}