<?php
namespace App\Entity;
use App\Repository\BpCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=BpCategoryRepository::class)
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
class BpCategory extends BaseEntity
{
use SoftDeleteableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\OneToMany(targetEntity=BPModel::class, mappedBy="bpCategory")
*/
private $BpModel;
public function __construct()
{
$this->BpModel = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, BpModel>
*/
public function getBpModel(): Collection
{
return $this->BpModel;
}
public function addBpModel(BPModel $bpModel): self
{
if (!$this->BpModel->contains($bpModel)) {
$this->BpModel[] = $bpModel;
$bpModel->setBpCategory($this);
}
return $this;
}
public function removeBpModel(BPModel $bpModel): self
{
if ($this->BpModel->removeElement($bpModel)) {
// set the owning side to null (unless already changed)
if ($bpModel->getBpCategory() === $this) {
$bpModel->setBpCategory(null);
}
}
return $this;
}
public function __toString()
{
return $this->label;
}
}