src/Entity/Position.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\PositionRepository")
  8.  */
  9. class Position
  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="position")
  27.      */
  28.     private $adminDonneurOrdres;
  29.     /**
  30.      * @ORM\Column(type="text", nullable=true)
  31.      */
  32.     private $description;
  33.     public function __construct(){
  34.         $this->createdAt = new \DateTime('now');
  35.         $this->adminDonneurOrdres = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getCreatedAt(): ?\DateTimeInterface
  51.     {
  52.         return $this->createdAt;
  53.     }
  54.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  55.     {
  56.         $this->createdAt $createdAt;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection|AdminDonneurOrdre[]
  61.      */
  62.     public function getAdminDonneurOrdres(): Collection
  63.     {
  64.         return $this->adminDonneurOrdres;
  65.     }
  66.     public function addAdminDonneurOrdre(AdminDonneurOrdre $adminDonneurOrdre): self
  67.     {
  68.         if (!$this->adminDonneurOrdres->contains($adminDonneurOrdre)) {
  69.             $this->adminDonneurOrdres[] = $adminDonneurOrdre;
  70.             $adminDonneurOrdre->setPosition($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeAdminDonneurOrdre(AdminDonneurOrdre $adminDonneurOrdre): self
  75.     {
  76.         if ($this->adminDonneurOrdres->contains($adminDonneurOrdre)) {
  77.             $this->adminDonneurOrdres->removeElement($adminDonneurOrdre);
  78.             // set the owning side to null (unless already changed)
  79.             if ($adminDonneurOrdre->getPosition() === $this) {
  80.                 $adminDonneurOrdre->setPosition(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85.     public function __toString(): string
  86.     {
  87.         return $this->name;
  88.     }
  89.     public function getDescription(): ?string
  90.     {
  91.         return $this->description;
  92.     }
  93.     public function setDescription(?string $description): self
  94.     {
  95.         $this->description $description;
  96.         return $this;
  97.     }
  98. }