src/Entity/FlowModel.php line 22

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\GetCollection;
  6. use App\Repository\FlowModelRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassFlowModelRepository::class)]
  10. #[ApiResource(
  11.     operations: [
  12.         new GetCollection(),
  13.         new Get(
  14.             normalizationContext: ['groups' => ['flow:list''flow:view']]
  15.         ),
  16.     ],
  17.     normalizationContext: ['groups' => ['flow:list']]
  18. )]
  19. class FlowModel
  20. {
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column]
  24.     #[Groups(['flow:list'])]
  25.     private ?int $id null;
  26.     #[ORM\Column(length255)]
  27.     #[Groups(['flow:list'])]
  28.     private ?string $name null;
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getName(): ?string
  34.     {
  35.         return $this->name;
  36.     }
  37.     public function setName(string $name): self
  38.     {
  39.         $this->name $name;
  40.         return $this;
  41.     }
  42. }