<?php
namespace App\Entity;
use App\Repository\PromoCodeRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=PromoCodeRepository::class)
* @UniqueEntity(fields={"code", "speaker"})
*/
class PromoCode
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $code;
/**
* @ORM\Column(type="integer")
*/
private $amount = 0;
/**
* @ORM\ManyToOne(targetEntity=Speaker::class, inversedBy="promoCodes")
*/
private $speaker;
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getAmount(): ?int
{
return $this->amount;
}
public function setAmount(int $amount): self
{
$this->amount = $amount;
return $this;
}
public function getSpeaker(): ?Speaker
{
return $this->speaker;
}
public function setSpeaker(?Speaker $speaker): self
{
$this->speaker = $speaker;
return $this;
}
public function __toString(): string
{
return $this->getCode();
}
}