src/Entity/SesionesValores.php line 50

  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Serializer\Annotation\Groups;
  4. use Ramsey\Uuid\Uuid;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Trait\UuidTrait;
  7. use App\State\SesionesValoresStateProcessor;
  8. use App\Repository\SesionesValoresRepository;
  9. use App\Controller\CreateEvaluacionesActionController;
  10. use ApiPlatform\Metadata\Put;
  11. use ApiPlatform\Metadata\Post;
  12. use ApiPlatform\Metadata\Patch;
  13. use ApiPlatform\Metadata\GetCollection;
  14. use ApiPlatform\Metadata\Get;
  15. use ApiPlatform\Metadata\Delete;
  16. use ApiPlatform\Metadata\ApiResource;
  17. use ApiPlatform\Metadata\ApiFilter;
  18. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  19. #[ORM\Entity(repositoryClassSesionesValoresRepository::class)]
  20. #[ApiResource(
  21.     operations: [
  22.         new GetCollection(uriTemplate'sesionesValores'),
  23.         // we post an array of evaluations, so we indicate that the input is an array
  24.         new Post(
  25.             uriTemplate'sesionesValores',
  26.             controllerCreateEvaluacionesActionController::class,
  27.             statelessfalse,
  28.             denormalizationContext: ['groups' => ['sesionesValores:createBulk']],
  29.         ),
  30.         new Get(uriTemplate'sesionesValores/{uuid}'),
  31.         new Put(uriTemplate'sesionesValores/{uuid}'denormalizationContext: ['groups' => ['sesionesValores:update']]),
  32.         new Patch(uriTemplate'sesionesValores/{uuid}'denormalizationContext: ['groups' => ['sesionesValores:update']]),
  33.         new Delete(uriTemplate'sesionesValores/{uuid}'),
  34.     ],
  35.     normalizationContext: ['groups' => ['sesionesValores:read''uuid']],
  36. )]
  37. #[ApiFilter(
  38.     SearchFilter::class,
  39.     properties: [
  40.         'empresa.uuid' => 'exact',
  41.         'evaluador.uuid' => 'exact',
  42.         'muestra.uuid' => 'exact',
  43.         'productoParametro.uuid' => 'exact',
  44.         'sesion.uuid' => 'exact',
  45.     ]
  46. )]
  47. class SesionesValores
  48. {
  49.     use UuidTrait;
  50.     #[Groups(['sesionesValores:read''sesion:read'])]
  51.     #[ORM\ManyToOne]
  52.     #[ORM\JoinColumn(nullablefalse)]
  53.     private ?Empresa $empresa null;
  54.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  55.     #[ORM\ManyToOne]
  56.     #[ORM\JoinColumn(nullablefalse)]
  57.     private ?User $evaluador null;
  58.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  59.     #[ORM\ManyToOne]
  60.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  61.     private ?Muestra $muestra null;
  62.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  63.     #[ORM\ManyToOne]
  64.     #[ORM\JoinColumn(nullablefalse)]
  65.     private ?ProductoParametros $productoParametro null;
  66.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  67.     #[ORM\Column(length255nullabletrue)]
  68.     private ?string $valor null;
  69.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  70.     #[ORM\Column(nullabletrue)]
  71.     private ?bool $isEvaluado null;
  72.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  73.     #[ORM\Column(nullabletrue)]
  74.     private ?bool $isCumple null;
  75.     #[Groups(['sesionesValores:read''sesionesValores:create''sesionesValores:update'])]
  76.     #[ORM\ManyToOne(inversedBy'sesionesValores')]
  77.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  78.     private ?Sesion $sesion null;
  79.     #[Groups(['sesionesValores:read'])]
  80.     #[ORM\Column(nullabletrue)]
  81.     private array $parametros = [];
  82.     #[Groups(['sesionesValores:createBulk'])]
  83.     private ?array $mixed null;
  84.     public function __construct()
  85.     {
  86.         $this->uuid Uuid::uuid4()->toString();
  87.     }
  88.     public function getEmpresa(): ?Empresa
  89.     {
  90.         return $this->empresa;
  91.     }
  92.     public function setEmpresa(?Empresa $empresa): self
  93.     {
  94.         $this->empresa $empresa;
  95.         return $this;
  96.     }
  97.     public function getEvaluador(): ?User
  98.     {
  99.         return $this->evaluador;
  100.     }
  101.     public function setEvaluador(?User $evaluador): self
  102.     {
  103.         $this->evaluador $evaluador;
  104.         return $this;
  105.     }
  106.     public function getMuestra(): ?Muestra
  107.     {
  108.         return $this->muestra;
  109.     }
  110.     public function setMuestra(?Muestra $muestra): self
  111.     {
  112.         $this->muestra $muestra;
  113.         return $this;
  114.     }
  115.     public function getProductoParametro(): ?ProductoParametros
  116.     {
  117.         return $this->productoParametro;
  118.     }
  119.     public function setProductoParametro(?ProductoParametros $productoParametro): self
  120.     {
  121.         $this->productoParametro $productoParametro;
  122.         return $this;
  123.     }
  124.     public function getValor(): ?string
  125.     {
  126.         return $this->valor;
  127.     }
  128.     public function setValor(?string $valor): self
  129.     {
  130.         $this->valor $valor;
  131.         return $this;
  132.     }
  133.     public function isIsEvaluado(): ?bool
  134.     {
  135.         return $this->isEvaluado;
  136.     }
  137.     public function setIsEvaluado(?bool $isEvaluado): self
  138.     {
  139.         $this->isEvaluado $isEvaluado;
  140.         return $this;
  141.     }
  142.     public function isIsCumple(): ?bool
  143.     {
  144.         return $this->isCumple;
  145.     }
  146.     public function setIsCumple(?bool $isCumple): self
  147.     {
  148.         $this->isCumple $isCumple;
  149.         return $this;
  150.     }
  151.     public function getSesion(): ?Sesion
  152.     {
  153.         return $this->sesion;
  154.     }
  155.     public function setSesion(?Sesion $sesion): self
  156.     {
  157.         $this->sesion $sesion;
  158.         return $this;
  159.     }
  160.     public function getParametros(): array
  161.     {
  162.         return $this->parametros;
  163.     }
  164.     public function setParametros(?array $parametros): self
  165.     {
  166.         $this->parametros $parametros;
  167.         return $this;
  168.     }
  169.     public function getMixed(): ?array { return $this->mixed; }
  170.     public function setMixed(?array $mixed): self $this->mixed $mixed; return $this; }
  171. }