<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use App\Repository\RecipeTestRawMaterialRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ApiResource(
collectionOperations: [
'get' => [
'normalization_context' => ['groups' => 'recipetestrawmaterial:list'],
],
'post' => [
'normalization_context' => ['groups' => 'recipetestrawmaterial:post'],
],
],
itemOperations: [
'get' => [
'normalization_context' => ['groups' => 'recipetestrawmaterial:item'],
],
'delete' => [
'method' => 'delete',
'normalization_context' => ['groups' => 'recipetestrawmaterial:delete'],
],
'patch' => [
'normalization_context' => ['groups' => 'recipetestrawmaterial:patch'],
],
],
denormalizationContext: ["disable_type_enforcement" => true],
order: ['id' => 'ASC'],
paginationEnabled: false,
)]
#[ApiFilter(SearchFilter::class, properties: ['recipeTest' => 'exact'])]
#[ORM\Entity(repositoryClass: RecipeTestRawMaterialRepository::class)]
class RecipeTestRawMaterial
{
public function __construct(
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:item'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id = 0
) {}
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\ManyToOne(targetEntity: RecipeTest::class, inversedBy: 'recipeTestRawMaterials')]
#[ORM\JoinColumn(nullable: false)]
private ?RecipeTest $recipeTest = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\ManyToOne(targetEntity: RawMaterial::class)]
#[ORM\JoinColumn(nullable: false)]
private ?RawMaterial $rawMaterial = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'string', length: 5, nullable: true)]
private ?string $phaseImported = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'float', nullable: true)]
private ?float $quantityImported = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'decimal', precision: 5, scale: 2, nullable: true)]
private ?string $percentageImported = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $observationsImported = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\ManyToOne(targetEntity: RecipeTestPhase::class, inversedBy: 'recipeTestPhaseRawMaterials')]
#[ORM\JoinColumn(nullable: false)]
private ?RecipeTestPhase $phase = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'float')]
private float $quantity;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:post', 'recipetestrawmaterial:patch', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $observations = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'float', nullable: true)]
private ?float $processedQuantity = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'decimal', precision: 5, scale: 2, nullable: true)]
private ?string $processedPercentage = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'decimal', precision: 8, scale: 4, nullable: true)]
private ?string $cost = null;
#[Groups(['recipetestrawmaterial:list', 'recipetestrawmaterial:item'])]
#[ORM\Column(type: 'json', nullable: true)]
private ?string $nutritionalInfo = null;
public function getId(): ?int
{
return $this->id;
}
public function getRecipeTest(): ?RecipeTest
{
return $this->recipeTest;
}
public function setRecipeTest(?RecipeTest $recipeTest): self
{
$this->recipeTest = $recipeTest;
return $this;
}
public function getRawMaterial(): ?RawMaterial
{
return $this->rawMaterial;
}
public function setRawMaterial(?RawMaterial $rawMaterial): self
{
$this->rawMaterial = $rawMaterial;
return $this;
}
public function getPhaseImported(): ?string
{
return $this->phaseImported;
}
public function setPhaseImported(?string $phaseImported): self
{
$this->phaseImported = $phaseImported;
return $this;
}
public function getQuantityImported(): ?float
{
return $this->quantityImported;
}
public function setQuantityImported(?float $quantityImported): self
{
$this->quantityImported = $quantityImported;
return $this;
}
public function getPercentageImported(): ?string
{
return $this->percentageImported;
}
public function setPercentageImported(?string $percentageImported): self
{
$this->percentageImported = $percentageImported;
return $this;
}
public function getObservationsImported(): ?string
{
return $this->observationsImported;
}
public function setObservationsImported(?string $observationsImported): self
{
$this->observationsImported = $observationsImported;
return $this;
}
public function getPhase(): ?RecipeTestPhase
{
return $this->phase;
}
public function setPhase(?RecipeTestPhase $phase): self
{
$this->phase = $phase;
return $this;
}
public function getQuantity(): ?float
{
return $this->quantity;
}
public function setQuantity(float $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getObservations(): ?string
{
return $this->observations;
}
public function setObservations(?string $observations): self
{
$this->observations = $observations;
return $this;
}
public function getProcessedQuantity(): ?float
{
return $this->processedQuantity;
}
public function setProcessedQuantity(?float $processedQuantity): RecipeTestRawMaterial
{
$this->processedQuantity = $processedQuantity;
return $this;
}
public function getProcessedPercentage(): ?string
{
return $this->processedPercentage;
}
public function setProcessedPercentage(?string $processedPercentage): RecipeTestRawMaterial
{
$this->processedPercentage = $processedPercentage;
return $this;
}
public function getCost(): ?string
{
return $this->cost;
}
public function setCost(?string $cost): RecipeTestRawMaterial
{
$this->cost = $cost;
return $this;
}
public function getNutritionalInfo(): ?string
{
return $this->nutritionalInfo;
}
public function setNutritionalInfo(?string $nutritionalInfo): RecipeTestRawMaterial
{
$this->nutritionalInfo = $nutritionalInfo;
return $this;
}
}