src/Entity/RecipeTestRawMaterial.php line 39

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use App\Repository\RecipeTestRawMaterialRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ApiResource(
  10.     collectionOperations: [
  11.     'get' => [
  12.         'normalization_context' => ['groups' => 'recipetestrawmaterial:list'],
  13.     ],
  14.     'post' => [
  15.         'normalization_context' => ['groups' => 'recipetestrawmaterial:post'],
  16.     ],
  17. ],
  18.     itemOperations: [
  19.     'get' => [
  20.         'normalization_context' => ['groups' => 'recipetestrawmaterial:item'],
  21.     ],
  22.     'delete' => [
  23.         'method' => 'delete',
  24.         'normalization_context' => ['groups' => 'recipetestrawmaterial:delete'],
  25.     ],
  26.     'patch' => [
  27.         'normalization_context' => ['groups' => 'recipetestrawmaterial:patch'],
  28.     ],
  29. ],
  30.     denormalizationContext: ["disable_type_enforcement" => true],
  31.     order: ['id' => 'ASC'],
  32.     paginationEnabledfalse,
  33. )]
  34. #[ApiFilter(SearchFilter::class, properties: ['recipeTest' => 'exact'])]
  35. #[ORM\Entity(repositoryClassRecipeTestRawMaterialRepository::class)]
  36. class RecipeTestRawMaterial
  37. {
  38.     public function __construct(
  39.         #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:item'])]
  40.         #[ORM\Id]
  41.         #[ORM\GeneratedValue]
  42.         #[ORM\Column(type'integer')]
  43.         private int $id 0
  44.     ) {}
  45.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  46.     #[ORM\ManyToOne(targetEntityRecipeTest::class, inversedBy'recipeTestRawMaterials')]
  47.     #[ORM\JoinColumn(nullablefalse)]
  48.     private ?RecipeTest $recipeTest null;
  49.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  50.     #[ORM\ManyToOne(targetEntityRawMaterial::class)]
  51.     #[ORM\JoinColumn(nullablefalse)]
  52.     private ?RawMaterial $rawMaterial null;
  53.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  54.     #[ORM\Column(type'string'length5nullabletrue)]
  55.     private ?string $phaseImported null;
  56.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  57.     #[ORM\Column(type'float'nullabletrue)]
  58.     private ?float $quantityImported null;
  59.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  60.     #[ORM\Column(type'decimal'precision5scale2nullabletrue)]
  61.     private ?string $percentageImported null;
  62.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  63.     #[ORM\Column(type'string'length255nullabletrue)]
  64.     private ?string $observationsImported null;
  65.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  66.     #[ORM\ManyToOne(targetEntityRecipeTestPhase::class, inversedBy'recipeTestPhaseRawMaterials')]
  67.     #[ORM\JoinColumn(nullablefalse)]
  68.     private ?RecipeTestPhase $phase null;
  69.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  70.     #[ORM\Column(type'float')]
  71.     private float $quantity;
  72.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:post',  'recipetestrawmaterial:patch''recipetestrawmaterial:item'])]
  73.     #[ORM\Column(type'string'length255nullabletrue)]
  74.     private ?string $observations null;
  75.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:item'])]
  76.     #[ORM\Column(type'float'nullabletrue)]
  77.     private ?float $processedQuantity null;
  78.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:item'])]
  79.     #[ORM\Column(type'decimal'precision5scale2nullabletrue)]
  80.     private ?string $processedPercentage null;
  81.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:item'])]
  82.     #[ORM\Column(type'decimal'precision8scale4nullabletrue)]
  83.     private ?string $cost null;
  84.     #[Groups(['recipetestrawmaterial:list''recipetestrawmaterial:item'])]
  85.     #[ORM\Column(type'json'nullabletrue)]
  86.     private ?string $nutritionalInfo null;
  87.     public function getId(): ?int
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function getRecipeTest(): ?RecipeTest
  92.     {
  93.         return $this->recipeTest;
  94.     }
  95.     public function setRecipeTest(?RecipeTest $recipeTest): self
  96.     {
  97.         $this->recipeTest $recipeTest;
  98.         return $this;
  99.     }
  100.     public function getRawMaterial(): ?RawMaterial
  101.     {
  102.         return $this->rawMaterial;
  103.     }
  104.     public function setRawMaterial(?RawMaterial $rawMaterial): self
  105.     {
  106.         $this->rawMaterial $rawMaterial;
  107.         return $this;
  108.     }
  109.     public function getPhaseImported(): ?string
  110.     {
  111.         return $this->phaseImported;
  112.     }
  113.     public function setPhaseImported(?string $phaseImported): self
  114.     {
  115.         $this->phaseImported $phaseImported;
  116.         return $this;
  117.     }
  118.     public function getQuantityImported(): ?float
  119.     {
  120.         return $this->quantityImported;
  121.     }
  122.     public function setQuantityImported(?float $quantityImported): self
  123.     {
  124.         $this->quantityImported $quantityImported;
  125.         return $this;
  126.     }
  127.     public function getPercentageImported(): ?string
  128.     {
  129.         return $this->percentageImported;
  130.     }
  131.     public function setPercentageImported(?string $percentageImported): self
  132.     {
  133.         $this->percentageImported $percentageImported;
  134.         return $this;
  135.     }
  136.     public function getObservationsImported(): ?string
  137.     {
  138.         return $this->observationsImported;
  139.     }
  140.     public function setObservationsImported(?string $observationsImported): self
  141.     {
  142.         $this->observationsImported $observationsImported;
  143.         return $this;
  144.     }
  145.     public function getPhase(): ?RecipeTestPhase
  146.     {
  147.         return $this->phase;
  148.     }
  149.     public function setPhase(?RecipeTestPhase $phase): self
  150.     {
  151.         $this->phase $phase;
  152.         return $this;
  153.     }
  154.     public function getQuantity(): ?float
  155.     {
  156.         return $this->quantity;
  157.     }
  158.     public function setQuantity(float $quantity): self
  159.     {
  160.         $this->quantity $quantity;
  161.         return $this;
  162.     }
  163.     public function getObservations(): ?string
  164.     {
  165.         return $this->observations;
  166.     }
  167.     public function setObservations(?string $observations): self
  168.     {
  169.         $this->observations $observations;
  170.         return $this;
  171.     }
  172.     public function getProcessedQuantity(): ?float
  173.     {
  174.         return $this->processedQuantity;
  175.     }
  176.     public function setProcessedQuantity(?float $processedQuantity): RecipeTestRawMaterial
  177.     {
  178.         $this->processedQuantity $processedQuantity;
  179.         return $this;
  180.     }
  181.     public function getProcessedPercentage(): ?string
  182.     {
  183.         return $this->processedPercentage;
  184.     }
  185.     public function setProcessedPercentage(?string $processedPercentage): RecipeTestRawMaterial
  186.     {
  187.         $this->processedPercentage $processedPercentage;
  188.         return $this;
  189.     }
  190.     public function getCost(): ?string
  191.     {
  192.         return $this->cost;
  193.     }
  194.     public function setCost(?string $cost): RecipeTestRawMaterial
  195.     {
  196.         $this->cost $cost;
  197.         return $this;
  198.     }
  199.     public function getNutritionalInfo(): ?string
  200.     {
  201.         return $this->nutritionalInfo;
  202.     }
  203.     public function setNutritionalInfo(?string $nutritionalInfo): RecipeTestRawMaterial
  204.     {
  205.         $this->nutritionalInfo $nutritionalInfo;
  206.         return $this;
  207.     }
  208. }