src/Entity/Promotion.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\PromotionRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PromotionRepository::class)
  9.  * @ApiResource(
  10.  *     collectionOperations={"get","post"},
  11.  *     itemOperations={"get","put","patch","delete"},
  12.  *     normalizationContext={"groups"={"promotion"}},
  13.  *     denormalizationContext={"groups"={"promotion"}},
  14.  *     attributes={"pagination_enabled"=false}
  15.  * )
  16.  */
  17. class Promotion
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      * @Groups("promotion")
  28.      */
  29.     private $customerId;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=Article::class, inversedBy="promotions")
  32.      * @ORM\JoinColumn(nullable=false)
  33.      * @Groups("promotion")
  34.      */
  35.     private $article;
  36.     /**
  37.      * @ORM\Column(type="float")
  38.      * @Groups("promotion")
  39.      */
  40.     private $price;
  41.     /**
  42.      * @ORM\Column(type="float")
  43.      * @Groups("promotion")
  44.      */
  45.     private $pricePromo;
  46.     /**
  47.      * @ORM\Column(type="date")
  48.      * @Groups("promotion")
  49.      */
  50.     private $date;
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getCustomerId(): ?string
  56.     {
  57.         return $this->customerId;
  58.     }
  59.     public function setCustomerId(string $customerId): self
  60.     {
  61.         $this->customerId $customerId;
  62.         return $this;
  63.     }
  64.     public function getArticle(): ?Article
  65.     {
  66.         return $this->article;
  67.     }
  68.     public function setArticle(?Article $article): self
  69.     {
  70.         $this->article $article;
  71.         return $this;
  72.     }
  73.     public function getPrice(): ?float
  74.     {
  75.         return $this->price;
  76.     }
  77.     public function setPrice(float $price): self
  78.     {
  79.         $this->price $price;
  80.         return $this;
  81.     }
  82.     public function getPricePromo(): ?float
  83.     {
  84.         return $this->pricePromo;
  85.     }
  86.     public function setPricePromo(float $pricePromo): self
  87.     {
  88.         $this->pricePromo $pricePromo;
  89.         return $this;
  90.     }
  91.     public function getDate(): ?\DateTimeInterface
  92.     {
  93.         return $this->date;
  94.     }
  95.     public function setDate(\DateTimeInterface $date): self
  96.     {
  97.         $this->date $date;
  98.         return $this;
  99.     }
  100. }