src/Entity/FlowAction.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\FlowActionRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClass: FlowActionRepository::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 FlowAction
  20. {
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column]
  24.     #[Groups(['flow:list'])]
  25.     private ?int $id = null;
  26.     #[ORM\Column(length: 255)]
  27.     #[Groups(['flow:list'])]
  28.     private ?string $name = null;
  29.     #[ORM\Column(length: 255, nullable: true)]
  30.     #[Groups(['flow:list'])]
  31.     private ?string $icon = null;
  32.     #[ORM\Column(length: 255)]
  33.     #[Groups(['flow:list'])]
  34.     private ?string $action = null;
  35.     #[ORM\ManyToOne(inversedBy: 'flowActions')]
  36.     #[ORM\JoinColumn(nullable: false)]
  37.     private ?FlowStep $step = null;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name = $name;
  49.         return $this;
  50.     }
  51.     public function getIcon(): ?string
  52.     {
  53.         return $this->icon;
  54.     }
  55.     public function setIcon(?string $icon): self
  56.     {
  57.         $this->icon = $icon;
  58.         return $this;
  59.     }
  60.     public function getAction(): ?string
  61.     {
  62.         return $this->action;
  63.     }
  64.     public function setAction(string $action): self
  65.     {
  66.         $this->action = $action;
  67.         return $this;
  68.     }
  69.     public function getStep(): ?FlowStep
  70.     {
  71.         return $this->step;
  72.     }
  73.     public function setStep(?FlowStep $step): self
  74.     {
  75.         $this->step = $step;
  76.         return $this;
  77.     }
  78. }