src/Entity/BpCategory.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BpCategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=BpCategoryRepository::class)
  11.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12.  */
  13. class BpCategory extends BaseEntity
  14. {
  15.     use SoftDeleteableEntity;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $label;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=true)
  28.      */
  29.     private $description;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=BPModel::class, mappedBy="bpCategory")
  32.      */
  33.     private $BpModel;
  34.     public function __construct()
  35.     {
  36.         $this->BpModel = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getLabel(): ?string
  43.     {
  44.         return $this->label;
  45.     }
  46.     public function setLabel(string $label): self
  47.     {
  48.         $this->label $label;
  49.         return $this;
  50.     }
  51.     public function getDescription(): ?string
  52.     {
  53.         return $this->description;
  54.     }
  55.     public function setDescription(?string $description): self
  56.     {
  57.         $this->description $description;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection<int, BpModel>
  62.      */
  63.     public function getBpModel(): Collection
  64.     {
  65.         return $this->BpModel;
  66.     }
  67.     public function addBpModel(BPModel $bpModel): self
  68.     {
  69.         if (!$this->BpModel->contains($bpModel)) {
  70.             $this->BpModel[] = $bpModel;
  71.             $bpModel->setBpCategory($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeBpModel(BPModel $bpModel): self
  76.     {
  77.         if ($this->BpModel->removeElement($bpModel)) {
  78.             // set the owning side to null (unless already changed)
  79.             if ($bpModel->getBpCategory() === $this) {
  80.                 $bpModel->setBpCategory(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85.     public function __toString()
  86.     {
  87.         return $this->label;
  88.     }
  89. }