src/Entity/PromoCode.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PromoCodeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7.  * @ORM\Entity(repositoryClass=PromoCodeRepository::class)
  8.  * @UniqueEntity(fields={"code", "speaker"})
  9.  */
  10. class PromoCode
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $code;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $amount 0;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Speaker::class, inversedBy="promoCodes")
  28.      */
  29.     private $speaker;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getCode(): ?string
  35.     {
  36.         return $this->code;
  37.     }
  38.     public function setCode(string $code): self
  39.     {
  40.         $this->code $code;
  41.         return $this;
  42.     }
  43.     public function getAmount(): ?int
  44.     {
  45.         return $this->amount;
  46.     }
  47.     public function setAmount(int $amount): self
  48.     {
  49.         $this->amount $amount;
  50.         return $this;
  51.     }
  52.     public function getSpeaker(): ?Speaker
  53.     {
  54.         return $this->speaker;
  55.     }
  56.     public function setSpeaker(?Speaker $speaker): self
  57.     {
  58.         $this->speaker $speaker;
  59.         return $this;
  60.     }
  61.     public function __toString(): string
  62.     {
  63.         return $this->getCode();
  64.     }
  65. }