src/Entity/Position.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AgentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\PositionRepository")
  9.  */
  10. class Position
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nomPosition;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $level;
  26.     /**
  27.      * @ORM\Column(type="string", length=500)
  28.      */
  29.     private $message;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="positions")
  32.      */
  33.     private $ville;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=SousPosition::class, mappedBy="trackPosition", orphanRemoval=true, cascade={"persist"})
  36.      * @ORM\OrderBy({"niveau" = "ASC"})
  37.      */
  38.     private $sousPositions;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private $visible;
  43.     public function __construct()
  44.     {
  45.         $this->sousPositions = new ArrayCollection();
  46.         $this->visible true;
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getNomPosition(): ?string
  53.     {
  54.         return $this->nomPosition;
  55.     }
  56.     /**
  57.      * @return Collection|SousPosition[]
  58.      */
  59.     public function getSousPositions(): Collection
  60.     {
  61.         return $this->sousPositions;
  62.     }
  63.     public function addSousPosition(SousPosition $sousPosition): self
  64.     {
  65.         if (!$this->sousPositions->contains($sousPosition)) {
  66.             $this->sousPositions[] = $sousPosition;
  67.             $sousPosition->setTrackPosition($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function setNomPosition(string $nomPosition): self
  72.     {
  73.         $this->nomPosition $nomPosition;
  74.         return $this;
  75.     }
  76.     public function getLevel(): ?int
  77.     {
  78.         return $this->level;
  79.     }
  80.     public function setLevel(int $level): self
  81.     {
  82.         $this->level $level;
  83.         return $this;
  84.     }
  85.     public function getMessage(): ?string
  86.     {
  87.         return $this->message;
  88.     }
  89.     public function setMessage(string $message): self
  90.     {
  91.         $this->message $message;
  92.         return $this;
  93.     }
  94.     public function getVille(): ?Ville
  95.     {
  96.         return $this->ville;
  97.     }
  98.     public function setVille(?Ville $ville): self
  99.     {
  100.         $this->ville $ville;
  101.         return $this;
  102.     }
  103.     public function setVisible(bool $visible): self $this->visible $visible; return $this; }
  104.     public function getVisible(): ?bool { return $this->visible; }
  105.     public function __toString()
  106.     {
  107.         return $this->nomPosition;
  108.     }
  109. }