<?php
namespace App\Entity;
use App\Repository\PointCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=PointCategoryRepository::class)
* @ORM\Table(name="point_category")
*/
class PointCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Assert\Valid()
* @ORM\OneToMany(targetEntity=PointCategoryItem::class, mappedBy="pointCategory", orphanRemoval=true, cascade={"persist","remove"})
*
* @Groups({ "pointCategory" })
*/
private Collection $pointCategoryItems;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Groups({ "pointCategory" })
*/
private ?bool $canBeReplacedByParent = false;
public function __construct()
{
$this->pointCategoryItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, PointCategoryItem>
*/
public function getPointCategoryItems(): Collection
{
return $this->pointCategoryItems;
}
public function addPointCategoryItem(PointCategoryItem $pointCategoryItem): self
{
if (!$this->pointCategoryItems->contains($pointCategoryItem)) {
$this->pointCategoryItems[] = $pointCategoryItem;
$pointCategoryItem->setPointCategory($this);
}
return $this;
}
public function removePointCategoryItem(PointCategoryItem $pointCategoryItem): self
{
if ($this->pointCategoryItems->removeElement($pointCategoryItem)) {
// set the owning side to null (unless already changed)
if ($pointCategoryItem->getPointCategory() === $this) {
$pointCategoryItem->setPointCategory(null);
}
}
return $this;
}
public function isCanBeReplacedByParent(): ?bool
{
return $this->canBeReplacedByParent;
}
public function setCanBeReplacedByParent(?bool $CanBeReplacedByParent): self
{
$this->canBeReplacedByParent = $CanBeReplacedByParent;
return $this;
}
}