src/Entity/InsuredEmission.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Trait\TimestampableEntity;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Serializer\Annotation\MaxDepth;
  9. #[ORM\Entity]
  10. #[ApiResource(iri'InsuredEmission')]
  11. class InsuredEmission
  12. {
  13.     use TimestampableEntity;
  14.     
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     #[Groups([
  19.         'insured:item:put',
  20.     ])]
  21.     private $id;
  22.     #[ApiProperty()]
  23.     #[Groups([
  24.         'emission:collection:post',
  25.         'emission:item:get',
  26.         'emission:item:put',
  27.     ])]
  28.     #[MaxDepth(1)]
  29.     #[ORM\ManyToOne(targetEntityInsured::class, inversedBy'emissions')]
  30.     private $insured;
  31.     #[ORM\ManyToOne(targetEntityEmission::class, inversedBy'insureds'cascade: ["persist"])]
  32.     #[Groups([
  33.         'insured:collection:post',
  34.         'insured:item:get',
  35.         'insured:item:put',
  36.     ])]
  37.     private $emission;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getInsured(): ?Insured
  43.     {
  44.         return $this->insured;
  45.     }
  46.     public function setInsured(?Insured $insured): self
  47.     {
  48.         $this->insured $insured;
  49.         return $this;
  50.     }
  51.     public function getEmission(): ?Emission
  52.     {
  53.         return $this->emission;
  54.     }
  55.     public function setEmission(?Emission $emission): self
  56.     {
  57.         $this->emission $emission;
  58.         return $this;
  59.     }
  60. }