<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\PromotionRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=PromotionRepository::class)
* @ApiResource(
* collectionOperations={"get","post"},
* itemOperations={"get","put","patch","delete"},
* normalizationContext={"groups"={"promotion"}},
* denormalizationContext={"groups"={"promotion"}},
* attributes={"pagination_enabled"=false}
* )
*/
class Promotion
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups("promotion")
*/
private $customerId;
/**
* @ORM\ManyToOne(targetEntity=Article::class, inversedBy="promotions")
* @ORM\JoinColumn(nullable=false)
* @Groups("promotion")
*/
private $article;
/**
* @ORM\Column(type="float")
* @Groups("promotion")
*/
private $price;
/**
* @ORM\Column(type="float")
* @Groups("promotion")
*/
private $pricePromo;
/**
* @ORM\Column(type="date")
* @Groups("promotion")
*/
private $date;
public function getId(): ?int
{
return $this->id;
}
public function getCustomerId(): ?string
{
return $this->customerId;
}
public function setCustomerId(string $customerId): self
{
$this->customerId = $customerId;
return $this;
}
public function getArticle(): ?Article
{
return $this->article;
}
public function setArticle(?Article $article): self
{
$this->article = $article;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function getPricePromo(): ?float
{
return $this->pricePromo;
}
public function setPricePromo(float $pricePromo): self
{
$this->pricePromo = $pricePromo;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
}