<?phpnamespace App\Entity;use App\Repository\RestrictionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=RestrictionRepository::class) */class Restriction{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $content; /** * @ORM\ManyToOne(targetEntity=Color::class) */ private $color; /** * @ORM\ManyToMany(targetEntity=Discount::class, mappedBy="restrictions") */ private $discounts; /** * @ORM\Column(type="boolean", nullable=true) */ private $isFeature; public function __construct() { $this->products = new ArrayCollection(); $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; } public function __toString() { return $this->content; } public function getColor(): ?Color { return $this->color; } public function setColor(?Color $color): self { $this->color = $color; 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->addRestriction($this); } return $this; } public function removeDiscount(Discount $discount): self { if ($this->discounts->contains($discount)) { $this->discounts->removeElement($discount); $discount->removeRestriction($this); } return $this; } public function getIsFeature(): ?bool { return $this->isFeature; } public function getIfFeature() { if($this->getIsFeature()){ return $this->getContent(); }else{ return ''; } } public function setIsFeature(?bool $isFeature): self { $this->isFeature = $isFeature; return $this; }}