src/Entity/AdditionalSkill.php line 110

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\AdditionalSkillRepository")
  6.  */
  7. class AdditionalSkill implements \JsonSerializable
  8. {
  9.     /**
  10.      * @ORM\Id()
  11.      * @ORM\GeneratedValue()
  12.      * @ORM\Column(type="integer")
  13.      */
  14.     private $id;
  15.     /**
  16.      * @ORM\ManyToOne(targetEntity="App\Entity\Skill")
  17.      */
  18.     private $skill;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $experience;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="App\Entity\SkillLevel")
  25.      */
  26.     private $level;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\Candidate", inversedBy="additionalSkills")
  29.      */
  30.     private $candidate;
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getSkill(): ?Skill
  36.     {
  37.         return $this->skill;
  38.     }
  39.     public function setSkill(?Skill $skill): self
  40.     {
  41.         $this->skill = $skill;
  42.         return $this;
  43.     }
  44.     public function getExperience(): ?string
  45.     {
  46.         return $this->experience;
  47.     }
  48.     public function setExperience(?string $experience): self
  49.     {
  50.         $this->experience = $experience;
  51.         return $this;
  52.     }
  53.     public function getLevel(): ?SkillLevel
  54.     {
  55.         return $this->level;
  56.     }
  57.     public function setLevel(?SkillLevel $level): self
  58.     {
  59.         $this->level = $level;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Candidate
  64.      */
  65.     public function getCandidate(): ?Candidate {
  66.         return $this->candidate;
  67.     }
  68.     /**
  69.      * @param Candidate $candidate
  70.      *
  71.      * @return self
  72.      */
  73.     public function setCandidate(Candidate $candidate): self {
  74.         $this->candidate = $candidate;
  75.         return $this;
  76.     }
  77.     public function __toString() {
  78.         return (string) $this->getSkill();
  79.     }
  80.     /**
  81.      * Specify data which should be serialized to JSON
  82.      *
  83.      * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
  84.      * @return mixed data which can be serialized by <b>json_encode</b>,
  85.      * which is a value of any type other than a resource.
  86.      * @since 5.4.0
  87.      */
  88.     public function jsonSerialize() {
  89.         return [
  90.             'id' => $this->getId(),
  91.             'skill' => $this->getSkill(),
  92.             'experience' => $this->getExperience(),
  93.             'level' => $this->getLevel(),
  94.         ];
  95.     }
  96. }