src/Entity/Bloc.php line 11
<?php
namespace App\Entity;
use App\Repository\BlocRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BlocRepository::class)]
class Bloc
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'blocs')]
private ?Fiche $fiche = null;
#[ORM\OneToMany(mappedBy: 'bloc', targetEntity: Element::class)]
private Collection $elements;
#[ORM\Column(length: 255)]
private ?string $titre = null;
public function __construct()
{
$this->elements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFiche(): ?Fiche
{
return $this->fiche;
}
public function setFiche(?Fiche $fiche): self
{
$this->fiche = $fiche;
return $this;
}
/**
* @return Collection<int, Element>
*/
public function getElements(): Collection
{
return $this->elements;
}
public function addElement(Element $element): self
{
if (!$this->elements->contains($element)) {
$this->elements->add($element);
$element->setBloc($this);
}
return $this;
}
public function removeElement(Element $element): self
{
if ($this->elements->removeElement($element)) {
// set the owning side to null (unless already changed)
if ($element->getBloc() === $this) {
$element->setBloc(null);
}
}
return $this;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
}