<?php
namespace App\Entity;
use App\Repository\RubriqueRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RubriqueRepository::class)]
class Rubrique
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
#[ORM\Column(length: 255)]
private ?string $titre = null;
#[ORM\Column]
private ?bool $param_commun = true;
#[ORM\Column]
private ?bool $param_option = false;
#[ORM\Column]
private ?bool $param_sur_mesure = true;
#[ORM\Column]
private ?bool $actif = true;
#[ORM\Column]
private ?int $ordre = null;
#[ORM\ManyToOne(inversedBy: 'rubriques')]
private ?Section $section = null;
#[ORM\OneToMany(mappedBy: 'rubrique', targetEntity: Element::class , cascade: ['remove', 'persist'])]
private Collection $elements;
public function __construct()
{
$this->elements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): static
{
$this->titre = $titre;
return $this;
}
public function isParamCommun(): ?bool
{
return $this->param_commun;
}
public function setParamCommun(bool $param_commun): static
{
$this->param_commun = $param_commun;
return $this;
}
public function isParamOption(): ?bool
{
return $this->param_option;
}
public function setParamOption(bool $param_option): static
{
$this->param_option = $param_option;
return $this;
}
public function isParamSurMesure(): ?bool
{
return $this->param_sur_mesure;
}
public function setParamSurMesure(bool $param_sur_mesure): static
{
$this->param_sur_mesure = $param_sur_mesure;
return $this;
}
public function isActif(): ?bool
{
return $this->actif;
}
public function setActif(bool $actif): static
{
$this->actif = $actif;
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(int $ordre): static
{
$this->ordre = $ordre;
return $this;
}
public function getSection(): ?Section
{
return $this->section;
}
public function setSection(?Section $section): static
{
$this->section = $section;
return $this;
}
/**
* @return Collection<int, Element>
*/
public function getElements(): Collection
{
return $this->elements;
}
public function addElement(Element $element): static
{
if (!$this->elements->contains($element)) {
$this->elements->add($element);
$element->setRubrique($this);
}
return $this;
}
public function removeElement(Element $element): static
{
if ($this->elements->removeElement($element)) {
// set the owning side to null (unless already changed)
if ($element->getRubrique() === $this) {
$element->setRubrique(null);
}
}
return $this;
}
}