<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Translatable;
use App\Repository\DiscountRepository;
use App\Entity\Translation\PageTranslation;
use App\Entity\Translation\DiscountTranslation;
use Gedmo\Mapping\Annotation\TranslationEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation\Locale as GedmoLocale;
use Gedmo\Mapping\Annotation\Translatable as GedmoTranslatable;
#[ORM\Entity(repositoryClass: DiscountRepository::class)]
#[TranslationEntity(class: DiscountTranslation::class)]
class Discount implements EntityInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[GedmoTranslatable]
#[ORM\Column(length: 255)]
private ?string $name = '';
#[ORM\Column]
private ?int $value = 0;
#[ORM\Column]
private ?int $nakop = 0;
#[GedmoLocale]
private $locale;
#[ORM\OneToMany(targetEntity: DiscountTranslation::class, mappedBy: 'object', cascade: ['persist', 'remove'])]
private $translations;
public function __construct()
{
$this->translations = new ArrayCollection();
}
public function setLocale($locale)
{
$this->locale = $locale;
}
public function getTranslations()
{
return $this->translations;
}
public function addTranslation(DiscountTranslation $t)
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setObject($this);
}
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getValue(): ?int
{
return $this->value;
}
public function setValue(int $value): self
{
$this->value = $value;
return $this;
}
public function getNakop(): ?int
{
return $this->nakop;
}
public function setNakop(int $nakop): self
{
$this->nakop = $nakop;
return $this;
}
}