src/App/Entity/JobseekerOccupationalFieldCapabilityValue.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Profile\JobseekerProfile;
  4. use App\Service\OccupationalFieldCapabilitiesService;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Exception;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * @ORM\Entity
  10. *
  11. * @ORM\Table(
  12. * name="jobseeker_occupational_field_capability_values",
  13. * uniqueConstraints={@ORM\UniqueConstraint(name="jobseeker_profiles_id_capability_idx", columns={"jobseeker_profiles_id", "capability_id"})}
  14. * )
  15. */
  16. class JobseekerOccupationalFieldCapabilityValue
  17. {
  18. /**
  19. * @var JobseekerProfile
  20. *
  21. * @ORM\Id
  22. *
  23. * @ORM\ManyToOne(targetEntity="App\Entity\Profile\JobseekerProfile", inversedBy="occupationalFieldCapabilityValues", cascade={"persist"})
  24. *
  25. * @ORM\JoinColumn(name="jobseeker_profiles_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  26. */
  27. private $jobseekerProfile;
  28. public function setJobseekerProfile(JobseekerProfile $jobseekerProfile): self
  29. {
  30. $this->jobseekerProfile = $jobseekerProfile;
  31. return $this;
  32. }
  33. public function getJobseekerProfile(): ?JobseekerProfile
  34. {
  35. return $this->jobseekerProfile;
  36. }
  37. /**
  38. * @var int
  39. *
  40. * @ORM\Id
  41. *
  42. * @ORM\Column(name="capability_id", type="integer", nullable=false)
  43. */
  44. private $capabilityId;
  45. /** @throws Exception */
  46. public function setCapabilityId(int $capabilityId): self
  47. {
  48. if (!OccupationalFieldCapabilitiesService::isValidCapabilityId($capabilityId)) {
  49. throw new Exception('Cannot set JobseekerOccupationalFieldCapabilityValue capability for ' . $capabilityId);
  50. }
  51. $this->capabilityId = $capabilityId;
  52. return $this;
  53. }
  54. public function getCapabilityId(): int
  55. {
  56. return $this->capabilityId;
  57. }
  58. /**
  59. * @var int
  60. *
  61. * @Assert\GreaterThanOrEqual(0)
  62. *
  63. * @Assert\LessThanOrEqual(5)
  64. *
  65. * @Assert\NotNull()
  66. *
  67. * @ORM\Column(name="value", type="integer", nullable=false)
  68. */
  69. private $value;
  70. public function setValue(int $value): self
  71. {
  72. $this->value = $value;
  73. return $this;
  74. }
  75. public function getValue(): int
  76. {
  77. return $this->value;
  78. }
  79. }