<?php
namespace App\Entity;
use App\Entity\Profile\JobseekerProfile;
use App\Service\OccupationalFieldCapabilitiesService;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="jobseeker_occupational_field_capability_values",
* uniqueConstraints={@ORM\UniqueConstraint(name="jobseeker_profiles_id_capability_idx", columns={"jobseeker_profiles_id", "capability_id"})}
* )
*/
class JobseekerOccupationalFieldCapabilityValue
{
/**
* @var JobseekerProfile
*
* @ORM\Id
*
* @ORM\ManyToOne(targetEntity="App\Entity\Profile\JobseekerProfile", inversedBy="occupationalFieldCapabilityValues", cascade={"persist"})
*
* @ORM\JoinColumn(name="jobseeker_profiles_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
private $jobseekerProfile;
public function setJobseekerProfile(JobseekerProfile $jobseekerProfile): self
{
$this->jobseekerProfile = $jobseekerProfile;
return $this;
}
public function getJobseekerProfile(): ?JobseekerProfile
{
return $this->jobseekerProfile;
}
/**
* @var int
*
* @ORM\Id
*
* @ORM\Column(name="capability_id", type="integer", nullable=false)
*/
private $capabilityId;
/** @throws Exception */
public function setCapabilityId(int $capabilityId): self
{
if (!OccupationalFieldCapabilitiesService::isValidCapabilityId($capabilityId)) {
throw new Exception('Cannot set JobseekerOccupationalFieldCapabilityValue capability for ' . $capabilityId);
}
$this->capabilityId = $capabilityId;
return $this;
}
public function getCapabilityId(): int
{
return $this->capabilityId;
}
/**
* @var int
*
* @Assert\GreaterThanOrEqual(0)
*
* @Assert\LessThanOrEqual(5)
*
* @Assert\NotNull()
*
* @ORM\Column(name="value", type="integer", nullable=false)
*/
private $value;
public function setValue(int $value): self
{
$this->value = $value;
return $this;
}
public function getValue(): int
{
return $this->value;
}
}