<?php
namespace App\Entity;
use App\Repository\DiscountTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DiscountTypeRepository::class)
*/
class DiscountType
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $content;
/**
* @ORM\OneToMany(targetEntity=Discount::class, mappedBy="discountType")
*/
private $discounts;
public function __construct()
{
$this->discounts = 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;
}
/**
* @return Collection|Discount[]
*/
public function getDiscounts(): Collection
{
return $this->discounts;
}
public function addDiscount(Discount $discount): self
{
if (!$this->discounts->contains($discount)) {
$this->discounts[] = $discount;
$discount->setDiscountType($this);
}
return $this;
}
public function removeDiscount(Discount $discount): self
{
if ($this->discounts->contains($discount)) {
$this->discounts->removeElement($discount);
// set the owning side to null (unless already changed)
if ($discount->getDiscountType() === $this) {
$discount->setDiscountType(null);
}
}
return $this;
}
public function __toString()
{
return $this->content;
}
}