<?php
namespace App\Entity;
use App\Entity\Enum\SkillLevel;
use App\Repository\SkillRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SkillRepository::class)
*/
class Skill
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
public $id;
/**
* @ORM\Column(type="string", length=255)
*/
public $name;
/**
* @ORM\Column(type="integer")
*/
public $level;
/**
* @ORM\ManyToOne(targetEntity=Profile::class, inversedBy="skills")
* @ORM\JoinColumn(nullable=false,onDelete="CASCADE")
*/
private $profile;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getLevel(): ?int
{
return $this->level;
}
public function setLevel(int $level): self
{
$this->level = $level;
return $this;
}
public function getSkillLabel() :string
{
return array_search($this->level, SkillLevel::LIST);
}
public function getProfile(): ?Profile
{
return $this->profile;
}
public function setProfile(?Profile $profile): self
{
$this->profile = $profile;
return $this;
}
}