src/Entity/Rubrique.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RubriqueRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\DBAL\Types\Types;
  8. #[ORM\Entity(repositoryClassRubriqueRepository::class)]
  9. class Rubrique
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $libelle;
  17. //    #[ORM\Column(type: Types::TEXT, length: 10000, nullable: true)]
  18. //    private $description;
  19.     #[ORM\ManyToOne(inversedBy'rubriques')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private ?Service $service null;
  22.     #[ORM\Column]
  23.     private ?bool $isShowable null;
  24.     #[ORM\OneToMany(mappedBy'rubrique'targetEntityPrestation::class, orphanRemovaltruecascade: ['persist''remove'] )]
  25.     private Collection $prestations;
  26.     public function __construct()
  27.     {
  28.         $this->axe = new ArrayCollection();
  29.         $this->prestations = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getLibelle(): ?string
  36.     {
  37.         return $this->libelle;
  38.     }
  39.     public function setLibelle(string $libelle): self
  40.     {
  41.         $this->libelle $libelle;
  42.         return $this;
  43.     }
  44. //    public function getDescription(): ?string
  45. //    {
  46. //        return $this->description;
  47. //    }
  48. //
  49. //    public function setDescription(string $description): self
  50. //    {
  51. //        $this->description = $description;
  52. //
  53. //        return $this;
  54. //    }
  55.     public function getService(): ?Service
  56.     {
  57.         return $this->service;
  58.     }
  59.     public function setService(?Service $service): self
  60.     {
  61.         $this->service $service;
  62.         return $this;
  63.     }
  64.     public function isIsShowable(): ?bool
  65.     {
  66.         return $this->isShowable;
  67.     }
  68.     public function setIsShowable(bool $isShowable): self
  69.     {
  70.         $this->isShowable $isShowable;
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return Collection<int, Prestation>
  75.      */
  76.     public function getPrestations(): Collection
  77.     {
  78.         return $this->prestations;
  79.     }
  80.     public function addPrestation(Prestation $prestation): self
  81.     {
  82.         if (!$this->prestations->contains($prestation)) {
  83.             $this->prestations->add($prestation);
  84.             $prestation->setRubrique($this);
  85.         }
  86.         return $this;
  87.     }
  88.     public function removePrestation(Prestation $prestation): self
  89.     {
  90.         if ($this->prestations->removeElement($prestation)) {
  91.             // set the owning side to null (unless already changed)
  92.             if ($prestation->getRubrique() === $this) {
  93.                 $prestation->setRubrique(null);
  94.             }
  95.         }
  96.         return $this;
  97.     }
  98.     public function __toString()
  99.     {
  100.         return $this->libelle;
  101.     }
  102. }