<?phpnamespace App\Entity;use App\Repository\CouponRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CouponRepository::class) */class Coupon{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $content; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $stripeId; /** * @ORM\OneToMany(targetEntity=PromoCode::class, mappedBy="coupon") */ private $promoCodes; /** * @ORM\Column(type="float", nullable=true) */ private $percentOff; public function __construct() { $this->promoCodes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getContent(): ?string { return $this->content; } public function setContent(string $content): self { $this->content = $content; return $this; } public function getStripeId(): ?string { return $this->stripeId; } public function setStripeId(string $stripeId): self { $this->stripeId = $stripeId; return $this; } /** * @return Collection<int, PromoCode> */ public function getPromoCodes(): Collection { return $this->promoCodes; } public function addPromoCode(PromoCode $promoCode): self { if (!$this->promoCodes->contains($promoCode)) { $this->promoCodes[] = $promoCode; $promoCode->setCoupon($this); } return $this; } public function removePromoCode(PromoCode $promoCode): self { if ($this->promoCodes->removeElement($promoCode)) { // set the owning side to null (unless already changed) if ($promoCode->getCoupon() === $this) { $promoCode->setCoupon(null); } } return $this; } public function __toString() { return $this->content; } public function getPercentOff(): ?int { return $this->percentOff; } public function setPercentOff(?int $percentOff): self { $this->percentOff = $percentOff; return $this; }}