<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\SalaryRangeRepository")
*/
class SalaryRange
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $value;
/**
* @ORM\Column(type="integer")²
* @Assert\NotBlank()
* @Assert\Type(type="integer")
* @Gedmo\SortablePosition()
*/
private $position;
/**
* @ORM\OneToMany(targetEntity=WorkExperience::class, mappedBy="salaryRange")
*/
private $workExperiences;
public function __construct()
{
$this->workExperiences = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): self
{
$this->value = $value;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
public function __toString()
{
return $this->getValue();
}
/**
* @return Collection<int, WorkExperience>
*/
public function getWorkExperiences(): Collection
{
return $this->workExperiences;
}
public function addWorkExperience(WorkExperience $workExperience): self
{
if (!$this->workExperiences->contains($workExperience)) {
$this->workExperiences[] = $workExperience;
$workExperience->setSalaryRange($this);
}
return $this;
}
public function removeWorkExperience(WorkExperience $workExperience): self
{
if ($this->workExperiences->removeElement($workExperience)) {
// set the owning side to null (unless already changed)
if ($workExperience->getSalaryRange() === $this) {
$workExperience->setSalaryRange(null);
}
}
return $this;
}
}