<?php
namespace App\Entity;
use App\Repository\DevisTarifRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DevisTarifRepository::class)]
class DevisTarif
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 500, nullable: true)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $reference = null;
#[ORM\OneToMany(targetEntity: DevisSousSection::class, mappedBy: 'tarif')]
private Collection $devisSousSections;
public function __construct()
{
$this->devisSousSections = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): static
{
$this->nom = $nom;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): static
{
$this->reference = $reference;
return $this;
}
/**
* @return Collection<int, DevisSousSection>
*/
public function getDevisSousSections(): Collection
{
return $this->devisSousSections;
}
public function addDevisSousSection(DevisSousSection $devisSousSection): static
{
if (!$this->devisSousSections->contains($devisSousSection)) {
$this->devisSousSections->add($devisSousSection);
$devisSousSection->setTarif($this);
}
return $this;
}
public function removeDevisSousSection(DevisSousSection $devisSousSection): static
{
if ($this->devisSousSections->removeElement($devisSousSection)) {
// set the owning side to null (unless already changed)
if ($devisSousSection->getTarif() === $this) {
$devisSousSection->setTarif(null);
}
}
return $this;
}
}