src/Entity/Duree.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\DureeRepository")
  8.  */
  9. class Duree
  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="datetime")
  23.      */
  24.     private $createdAt;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity="App\Entity\AdminDonneurOrdre", mappedBy="duree")
  27.      */
  28.     private $adminDonneurOrdres;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\Transaction", mappedBy="duree")
  31.      */
  32.     private $transactions;
  33.     /**
  34.      * @ORM\Column(type="text", nullable=true)
  35.      */
  36.     private $description;
  37.     public function __construct(){
  38.         $this->createdAt = new \DateTime('now');
  39.         $this->adminDonneurOrdres = new ArrayCollection();
  40.         $this->transactions = new ArrayCollection();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): self
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getCreatedAt(): ?\DateTimeInterface
  56.     {
  57.         return $this->createdAt;
  58.     }
  59.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  60.     {
  61.         $this->createdAt $createdAt;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection|AdminDonneurOrdre[]
  66.      */
  67.     public function getAdminDonneurOrdres(): Collection
  68.     {
  69.         return $this->adminDonneurOrdres;
  70.     }
  71.     public function addAdminDonneurOrdre(AdminDonneurOrdre $adminDonneurOrdre): self
  72.     {
  73.         if (!$this->adminDonneurOrdres->contains($adminDonneurOrdre)) {
  74.             $this->adminDonneurOrdres[] = $adminDonneurOrdre;
  75.             $adminDonneurOrdre->setDuree($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeAdminDonneurOrdre(AdminDonneurOrdre $adminDonneurOrdre): self
  80.     {
  81.         if ($this->adminDonneurOrdres->contains($adminDonneurOrdre)) {
  82.             $this->adminDonneurOrdres->removeElement($adminDonneurOrdre);
  83.             // set the owning side to null (unless already changed)
  84.             if ($adminDonneurOrdre->getDuree() === $this) {
  85.                 $adminDonneurOrdre->setDuree(null);
  86.             }
  87.         }
  88.         return $this;
  89.     }
  90.     public function __toString(): string
  91.     {
  92.         return $this->name;
  93.     }
  94.     /**
  95.      * @return Collection|Transaction[]
  96.      */
  97.     public function getTransactions(): Collection
  98.     {
  99.         return $this->transactions;
  100.     }
  101.     public function addTransaction(Transaction $transaction): self
  102.     {
  103.         if (!$this->transactions->contains($transaction)) {
  104.             $this->transactions[] = $transaction;
  105.             $transaction->setDuree($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeTransaction(Transaction $transaction): self
  110.     {
  111.         if ($this->transactions->contains($transaction)) {
  112.             $this->transactions->removeElement($transaction);
  113.             // set the owning side to null (unless already changed)
  114.             if ($transaction->getDuree() === $this) {
  115.                 $transaction->setDuree(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120.     public function getDescription(): ?string
  121.     {
  122.         return $this->description;
  123.     }
  124.     public function setDescription(?string $description): self
  125.     {
  126.         $this->description $description;
  127.         return $this;
  128.     }
  129. }