src/Entity/TypeModePayement.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\TypeModePayementRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassTypeModePayementRepository::class)]
  10. #[ApiResource(
  11.     denormalizationContext:[
  12.         'groups'=>['TypeModePayement:write']
  13.     ],
  14.     normalizationContext:[
  15.         'groups'=>['TypeModePayement:read']
  16.     ],
  17. )]
  18. class TypeModePayement
  19. {
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column(type'integer')]
  23.     #[Groups(['TypeModePayement:read'])]
  24.     private $id;
  25.     #[ORM\Column(type'string'length90nullabletrue)]
  26.     #[Groups(['TypeModePayement:read'])]
  27.     private $label;
  28.     #[ORM\Column(type'integer'nullabletrue)]
  29.     #[Groups(['TypeModePayement:read'])]
  30.     private $code;
  31.     #[ORM\OneToMany(mappedBy'typeModePayement'targetEntityModePayement::class)]
  32.     #[Groups(['TypeModePayement:read'])]
  33.     private $modePayements;
  34.     public function __construct()
  35.     {
  36.         $this->modePayements = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getLabel(): ?string
  43.     {
  44.         return $this->label;
  45.     }
  46.     public function setLabel(?string $label): self
  47.     {
  48.         $this->label $label;
  49.         return $this;
  50.     }
  51.     public function getCode(): ?int
  52.     {
  53.         return $this->code;
  54.     }
  55.     public function setCode(?int $code): self
  56.     {
  57.         $this->code $code;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection<int, ModePayement>
  62.      */
  63.     public function getModePayements(): Collection
  64.     {
  65.         return $this->modePayements;
  66.     }
  67.     public function addModePayement(ModePayement $modePayement): self
  68.     {
  69.         if (!$this->modePayements->contains($modePayement)) {
  70.             $this->modePayements[] = $modePayement;
  71.             $modePayement->setTypeModePayement($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeModePayement(ModePayement $modePayement): self
  76.     {
  77.         if ($this->modePayements->removeElement($modePayement)) {
  78.             // set the owning side to null (unless already changed)
  79.             if ($modePayement->getTypeModePayement() === $this) {
  80.                 $modePayement->setTypeModePayement(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85. }