<?php
namespace App\Entity;
use App\Repository\CondRegleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=CondRegleRepository::class)
* @UniqueEntity(fields={"wording"},message="Ce libelle est déjà utilisé." )
*/
class CondRegle
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $wording;
/**
* @ORM\OneToMany(targetEntity=Financement::class, mappedBy="conditionreglement")
*/
private $financements;
public function __construct()
{
$this->financements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getWording(): ?string
{
return $this->wording;
}
public function setWording(string $wording): self
{
$this->wording = $wording;
return $this;
}
/**
* @return Collection<int, Financement>
*/
public function getFinancements(): Collection
{
return $this->financements;
}
public function addFinancement(Financement $financement): self
{
if (!$this->financements->contains($financement)) {
$this->financements[] = $financement;
$financement->setConditionreglement($this);
}
return $this;
}
public function removeFinancement(Financement $financement): self
{
if ($this->financements->removeElement($financement)) {
// set the owning side to null (unless already changed)
if ($financement->getConditionreglement() === $this) {
$financement->setConditionreglement(null);
}
}
return $this;
}
}