src/Entity/FlowUser.php line 23

  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\FlowUserRepository;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassFlowUserRepository::class)]
  11. #[ApiResource(
  12.     operations: [
  13.         new GetCollection(),
  14.         new Get(
  15.             normalizationContext: ['groups' => ['flow:list''flow:view']]
  16.         ),
  17.     ],
  18.     normalizationContext: ['groups' => ['flow:list']]
  19. )]
  20. class FlowUser
  21. {
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column]
  25.     #[Groups(['flow:list'])]
  26.     private ?int $id null;
  27.     #[ORM\ManyToOne(inversedBy'flowUsers')]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     #[Groups(['flow:list'])]
  30.     private ?Employee $user null;
  31.     #[ORM\Column(nullabletrue)]
  32.     #[Groups(['flow:list'])]
  33.     private array $roles = [];
  34.     #[ORM\ManyToOne(inversedBy'flowUsers')]
  35.     #[ORM\JoinColumn(nullablefalse)]
  36.     private ?Flow $flow null;
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getUser(): ?Employee
  42.     {
  43.         return $this->user;
  44.     }
  45.     public function setUser(?Employee $user): self
  46.     {
  47.         $this->user $user;
  48.         return $this;
  49.     }
  50.     public function getRoles(): array
  51.     {
  52.         return $this->roles;
  53.     }
  54.     public function setRoles(?array $roles): self
  55.     {
  56.         $this->roles $roles;
  57.         return $this;
  58.     }
  59.     public function getFlow(): ?Flow
  60.     {
  61.         return $this->flow;
  62.     }
  63.     public function setFlow(?Flow $flow): self
  64.     {
  65.         $this->flow $flow;
  66.         return $this;
  67.     }
  68. }