src/Entity/Exigence.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ExigenceRepository")
  8.  */
  9. class Exigence
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="text", nullable=true)
  23.      */
  24.     private $description;
  25.     /**
  26.      * @ORM\Column(type="datetime", nullable=true)
  27.      */
  28.     private $createdAt;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\LetterOfIntentToPurchase", mappedBy="exigence")
  31.      */
  32.     private $letterOfIntentToPurchases;
  33.     public function __construct(){
  34.         $this->createdAt = new \DateTime('now');
  35.         $this->letterOfIntentToPurchases = new ArrayCollection();
  36.     }
  37.     public function __toString(){
  38.         return $this->name;
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(?string $description): self
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     public function getCreatedAt(): ?\DateTimeInterface
  63.     {
  64.         return $this->createdAt;
  65.     }
  66.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  67.     {
  68.         $this->createdAt $createdAt;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection|LetterOfIntentToPurchase[]
  73.      */
  74.     public function getLetterOfIntentToPurchases(): Collection
  75.     {
  76.         return $this->letterOfIntentToPurchases;
  77.     }
  78.     public function addLetterOfIntentToPurchase(LetterOfIntentToPurchase $letterOfIntentToPurchase): self
  79.     {
  80.         if (!$this->letterOfIntentToPurchases->contains($letterOfIntentToPurchase)) {
  81.             $this->letterOfIntentToPurchases[] = $letterOfIntentToPurchase;
  82.             $letterOfIntentToPurchase->setExigence($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeLetterOfIntentToPurchase(LetterOfIntentToPurchase $letterOfIntentToPurchase): self
  87.     {
  88.         if ($this->letterOfIntentToPurchases->contains($letterOfIntentToPurchase)) {
  89.             $this->letterOfIntentToPurchases->removeElement($letterOfIntentToPurchase);
  90.             // set the owning side to null (unless already changed)
  91.             if ($letterOfIntentToPurchase->getExigence() === $this) {
  92.                 $letterOfIntentToPurchase->setExigence(null);
  93.             }
  94.         }
  95.         return $this;
  96.     }
  97. }