src/Entity/SalaryRange.php line 14

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. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\SalaryRangeRepository")
  10.  */
  11. class SalaryRange
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $value;
  23.     /**
  24.      * @ORM\Column(type="integer")²
  25.      * @Assert\NotBlank()
  26.      * @Assert\Type(type="integer")
  27.      * @Gedmo\SortablePosition()
  28.      */
  29.     private $position;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=WorkExperience::class, mappedBy="salaryRange")
  32.      */
  33.     private $workExperiences;
  34.     public function __construct()
  35.     {
  36.         $this->workExperiences = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getValue(): ?string
  43.     {
  44.         return $this->value;
  45.     }
  46.     public function setValue(string $value): self
  47.     {
  48.         $this->value $value;
  49.         return $this;
  50.     }
  51.     public function getPosition(): ?int
  52.     {
  53.         return $this->position;
  54.     }
  55.     public function setPosition(int $position): self
  56.     {
  57.         $this->position $position;
  58.         return $this;
  59.     }
  60.     public function __toString()
  61.     {
  62.         return $this->getValue();
  63.     }
  64.     /**
  65.      * @return Collection<int, WorkExperience>
  66.      */
  67.     public function getWorkExperiences(): Collection
  68.     {
  69.         return $this->workExperiences;
  70.     }
  71.     public function addWorkExperience(WorkExperience $workExperience): self
  72.     {
  73.         if (!$this->workExperiences->contains($workExperience)) {
  74.             $this->workExperiences[] = $workExperience;
  75.             $workExperience->setSalaryRange($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeWorkExperience(WorkExperience $workExperience): self
  80.     {
  81.         if ($this->workExperiences->removeElement($workExperience)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($workExperience->getSalaryRange() === $this) {
  84.                 $workExperience->setSalaryRange(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89. }