<?php
namespace App\Entity;
use App\Repository\DiscountNameRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DiscountNameRepository::class)
*/
class DiscountName
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $content;
public function getId(): ?int
{
return $this->id;
}
/**
* @ORM\OneToMany(targetEntity=Discount::class, mappedBy="discountName")
*/
private $discounts;
public function __construct()
{
$this->discounts = new ArrayCollection();
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function __toString()
{
return $this->content;
}
/**
* @return Collection<int, Discount>
*/
public function getDiscounts(): Collection
{
return $this->discounts;
}
public function addDiscount(Discount $discount): self
{
if (!$this->discounts->contains($discount)) {
$this->discounts[] = $discount;
$discount->setDiscountName($this);
}
return $this;
}
public function removeDiscount(Discount $discount): self
{
if ($this->discounts->removeElement($discount)) {
// set the owning side to null (unless already changed)
if ($discount->getDiscountName() === $this) {
$discount->setDiscountName(null);
}
}
return $this;
}
}