src/Entity/ServicesCategories.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServicesCategoriesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ServicesCategoriesRepository::class)
  9.  */
  10. class ServicesCategories
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $label;
  22.     /**
  23.      * @ORM\Column(type="text", nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Services::class, mappedBy="category", orphanRemoval=true)
  28.      */
  29.     private $resources;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $slug;
  34.     
  35.     /**
  36.      * @ORM\Column(name="isEnabled", type="boolean", nullable=true)
  37.      */
  38.     private $isEnabled;
  39.     public function __construct()
  40.     {
  41.         $this->isEnabled false;
  42.         $this->resources = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getLabel(): ?string
  49.     {
  50.         return $this->label;
  51.     }
  52.     public function setLabel(string $label): self
  53.     {
  54.         $this->label $label;
  55.         return $this;
  56.     }
  57.     public function getDescription(): ?string
  58.     {
  59.         return $this->description;
  60.     }
  61.     public function setDescription(?string $description): self
  62.     {
  63.         $this->description $description;
  64.         return $this;
  65.     }
  66.     public function getServices(): Collection
  67.     {
  68.         return $this->resources;
  69.     }
  70.     public function addResource(Services $resource): self
  71.     {
  72.         if (!$this->resources->contains($resource)) {
  73.             $this->resources[] = $resource;
  74.             $resource->setCategory($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeResource(Services $resource): self
  79.     {
  80.         if ($this->resources->contains($resource)) {
  81.             $this->resources->removeElement($resource);
  82.             // set the owning side to null (unless already changed)
  83.             if ($resource->getCategory() === $this) {
  84.                 $resource->setCategory(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     public function __toString()
  90.     {
  91.         return $this->label;
  92.     }
  93.     public function getSlug(): ?string
  94.     {
  95.         return $this->slug;
  96.     }
  97.     public function setSlug(?string $slug): self
  98.     {
  99.         $this->slug $slug;
  100.         return $this;
  101.     }
  102.     public function getIsEnabled(): ?bool
  103.     {
  104.         return $this->isEnabled;
  105.     }
  106.     public function setIsEnabled(?bool $isEnabled): self
  107.     {
  108.         $this->isEnabled $isEnabled;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection<int, Services>
  113.      */
  114.     public function getResources(): Collection
  115.     {
  116.         return $this->resources;
  117.     }
  118. }