src/Entity/Bloc.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlocRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassBlocRepository::class)]
  8. class Bloc
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(inversedBy'blocs')]
  15.     private ?Fiche $fiche null;
  16.     #[ORM\OneToMany(mappedBy'bloc'targetEntityElement::class)]
  17.     private Collection $elements;
  18.     #[ORM\Column(length255)]
  19.     private ?string $titre null;
  20.     public function __construct()
  21.     {
  22.         $this->elements = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getFiche(): ?Fiche
  29.     {
  30.         return $this->fiche;
  31.     }
  32.     public function setFiche(?Fiche $fiche): self
  33.     {
  34.         $this->fiche $fiche;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, Element>
  39.      */
  40.     public function getElements(): Collection
  41.     {
  42.         return $this->elements;
  43.     }
  44.     public function addElement(Element $element): self
  45.     {
  46.         if (!$this->elements->contains($element)) {
  47.             $this->elements->add($element);
  48.             $element->setBloc($this);
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeElement(Element $element): self
  53.     {
  54.         if ($this->elements->removeElement($element)) {
  55.             // set the owning side to null (unless already changed)
  56.             if ($element->getBloc() === $this) {
  57.                 $element->setBloc(null);
  58.             }
  59.         }
  60.         return $this;
  61.     }
  62.     public function getTitre(): ?string
  63.     {
  64.         return $this->titre;
  65.     }
  66.     public function setTitre(string $titre): self
  67.     {
  68.         $this->titre $titre;
  69.         return $this;
  70.     }
  71. }