src/Entity/CondRegle.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CondRegleRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=CondRegleRepository::class)
  11.  * @UniqueEntity(fields={"wording"},message="Ce libelle est déjà utilisé." )
  12.  */
  13. class CondRegle
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $wording;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=Financement::class, mappedBy="conditionreglement")
  27.      */
  28.     private $financements;
  29.     public function __construct()
  30.     {
  31.         $this->financements = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getWording(): ?string
  38.     {
  39.         return $this->wording;
  40.     }
  41.     public function setWording(string $wording): self
  42.     {
  43.         $this->wording $wording;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection<int, Financement>
  48.      */
  49.     public function getFinancements(): Collection
  50.     {
  51.         return $this->financements;
  52.     }
  53.     public function addFinancement(Financement $financement): self
  54.     {
  55.         if (!$this->financements->contains($financement)) {
  56.             $this->financements[] = $financement;
  57.             $financement->setConditionreglement($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removeFinancement(Financement $financement): self
  62.     {
  63.         if ($this->financements->removeElement($financement)) {
  64.             // set the owning side to null (unless already changed)
  65.             if ($financement->getConditionreglement() === $this) {
  66.                 $financement->setConditionreglement(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71. }