src/Entity/Product.php line 41

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Entity\Participation\Participation;
  5. use App\Repository\ProductRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Serializer\Annotation\SerializedName;
  9. /**
  10.  * @ApiResource(
  11.  *     attributes={
  12.  *          "normalization_context"={
  13.  *              "groups"={
  14.  *                  "Product:io",
  15.  *                  "Product:output",
  16.  *                  "Participation:io",
  17.  *               },
  18.  *              "enable_max_depth"=true
  19.  *          },
  20.  *          "denormalization_context"={
  21.  *              "groups"={
  22.  *                  "Product:io",
  23.  *                  "Product:input",
  24.  *                  "Participation:io",
  25.  *              },
  26.  *              "enable_max_depth"=true
  27.  *          }
  28.  *      },
  29.  *     collectionOperations={
  30.  *          "get",
  31.  *     },
  32.  *     itemOperations={
  33.  *          "get",
  34.  *     },
  35.  * )
  36.  * @ORM\Entity(repositoryClass=ProductRepository::class)
  37.  */
  38. class Product
  39. {
  40.     /**
  41.      * @ORM\Id
  42.      * @ORM\GeneratedValue
  43.      * @ORM\Column(type="integer")
  44.      * @SerializedName("id")
  45.      * @Groups({
  46.      *     "Participation:io",
  47.      * })
  48.      */
  49.     private $id;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      * @SerializedName("label")
  53.      * @Groups({
  54.      *     "Participation:io",
  55.      * })
  56.      */
  57.     private $label;
  58.     /**
  59.      * @ORM\Column(type="integer", nullable=true)
  60.      * @SerializedName("quantity")
  61.      * @Groups({
  62.      *     "Participation:io",
  63.      * })
  64.      */
  65.     private $quantity;
  66.     /**
  67.      * @ORM\Column(type="float", nullable=true)
  68.      * @SerializedName("unit_amount")
  69.      * @Groups({
  70.      *     "Participation:io",
  71.      * })
  72.      */
  73.     private $unitAmount;
  74.     /**
  75.      * @ORM\ManyToOne(targetEntity=Participation::class)
  76.      */
  77.     private $participation;
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getLabel(): ?string
  83.     {
  84.         return $this->label;
  85.     }
  86.     public function setLabel(?string $label): self
  87.     {
  88.         $this->label $label;
  89.         return $this;
  90.     }
  91.     public function getQuantity(): ?int
  92.     {
  93.         return $this->quantity;
  94.     }
  95.     public function setQuantity(?int $quantity): self
  96.     {
  97.         $this->quantity $quantity;
  98.         return $this;
  99.     }
  100.     public function getUnitAmount(): ?float
  101.     {
  102.         return $this->unitAmount;
  103.     }
  104.     public function setUnitAmount(?float $unitAmount): self
  105.     {
  106.         $this->unitAmount $unitAmount;
  107.         return $this;
  108.     }
  109.     public function getParticipation(): ?Participation
  110.     {
  111.         return $this->participation;
  112.     }
  113.     public function setParticipation(?Participation $participation): self
  114.     {
  115.         $this->participation $participation;
  116.         return $this;
  117.     }
  118. }