src/Entity/Personne.php line 34

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use ApiPlatform\Metadata\ApiFilter;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Post;
  9. use ApiPlatform\Metadata\Put;
  10. use ApiPlatform\Metadata\Patch;
  11. use App\Repository\PersonneRepository;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Symfony\Component\Serializer\Annotation\Groups;
  15. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  16. #[ORM\Entity(repositoryClassPersonneRepository::class)]
  17. #[ApiResource(
  18.     normalizationContext: ['groups' => ['read:personne']],
  19.     denormalizationContext: ['groups' => ['write:personne']],
  20.     operations: [
  21.         new Get(),
  22.         new GetCollection(),
  23.         new Post(),
  24.         new Put(),
  25.         new Patch(),
  26.     ],
  27.     paginationEnabledtrue,
  28.     paginationItemsPerPage30
  29. ),
  30. ApiFilter(SearchFilter::class, properties: ['user' => 'exact'])]
  31. class Personne
  32. {
  33.     #[ORM\Id]
  34.     #[ORM\GeneratedValue]
  35.     #[ORM\Column]
  36.     #[Groups(['read:personne','write:personne','read:user'])]
  37.     private ?int $id null;
  38.     #[ORM\Column(length255)]
  39.     #[Groups(['read:personne','write:personne','read:user'])] 
  40.     private ?string $Nom null;
  41.     #[ORM\Column(length255)]
  42.     #[Groups(['read:personne','write:personne','read:user'])]
  43.     private ?string $prenom null;
  44.     #[ORM\Column(length255nullabletrue)]
  45.     #[Groups(['read:personne','write:personne','read:user'])]
  46.     private ?string $pays null;
  47.     #[ORM\ManyToOne(inversedBy'personnes')]
  48.     #[Groups(['read:personne','write:personne','read:user'])]
  49.     private ?User $user null;
  50.     #[ORM\Column(length255nullabletrue)]
  51.     #[Groups(['read:personne','write:personne','read:user'])]
  52.     private ?string $sex null;
  53.     #[ORM\Column(length255nullabletrue)]
  54.     #[Groups(['read:personne','write:personne','read:user'])]
  55.     private ?string $tel null;
  56.     #[ORM\Column(length255,nullable:true)]
  57.     #[Groups(['read:personne','write:personne','read:user'])]
  58.     private ?string $avatar 'sans';
  59.     #[ORM\Column(length255)]
  60.     #[Groups(['read:personne','write:personne','read:user'])]
  61.     private ?string $solde '0.00';
  62.     #[ORM\Column(type'date'nullabletrue)]
  63.     #[Groups(['read:personne','write:personne','read:user'])]
  64.     private ?\DateTimeInterface $dateNaissance null;
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getNom(): ?string
  70.     {
  71.         return $this->Nom;
  72.     }
  73.     public function setNom(string $Nom): self
  74.     {
  75.         $this->Nom $Nom;
  76.         return $this;
  77.     }
  78.     public function getPrenom(): ?string
  79.     {
  80.         return $this->prenom;
  81.     }
  82.     public function setPrenom(string $prenom): self
  83.     {
  84.         $this->prenom $prenom;
  85.         return $this;
  86.     }
  87.     public function getPays(): ?string
  88.     {
  89.         return $this->pays;
  90.     }
  91.     public function setPays(string $pays): self
  92.     {
  93.         $this->pays $pays;
  94.         return $this;
  95.     }
  96.     public function getUser(): ?user
  97.     {
  98.         return $this->user;
  99.     }
  100.     public function setUser(?user $user): self
  101.     {
  102.         $this->user $user;
  103.         return $this;
  104.     }
  105.     public function getSex(): ?string
  106.     {
  107.         return $this->sex;
  108.     }
  109.     public function setSex(string $sex): self
  110.     {
  111.         $this->sex $sex;
  112.         return $this;
  113.     }
  114.     public function getTel(): ?string
  115.     {
  116.         return $this->tel;
  117.     }
  118.     public function setTel(string $tel): self
  119.     {
  120.         $this->tel $tel;
  121.         return $this;
  122.     }
  123.     public function getAvatar(): ?string
  124.     {
  125.         return $this->avatar;
  126.     }
  127.     public function setAvatar(string $avatar): self
  128.     {
  129.         $this->avatar $avatar;
  130.         return $this;
  131.     }
  132.     public function getSolde(): ?string
  133.     {
  134.         return $this->solde;
  135.     }
  136.     public function setSolde(string $solde): self
  137.     {
  138.         $this->solde $solde;
  139.         return $this;
  140.     }
  141.     public function getDateNaissance(): ?\DateTimeInterface
  142.     {
  143.         return $this->dateNaissance;
  144.     }
  145.     public function setDateNaissance(?\DateTimeInterface $dateNaissance): self
  146.     {
  147.         $this->dateNaissance $dateNaissance;
  148.         return $this;
  149.     }
  150. }