src/JanusHercules/CampaignWunschjobs/Presentation/Entity/JobseekerFlowFormDatabag.php line 18

Open in your IDE?
  1. <?php
  2. namespace JanusHercules\CampaignWunschjobs\Presentation\Entity;
  3. use App\Entity\Profile\JobseekerProfile;
  4. use App\Utility\DatabaseIdGenerator;
  5. use App\Utility\DateTimeUtility;
  6. use App\Validator\Constraint as AppAssert;
  7. use App\Value\ZipcodeRadiusesValue;
  8. use DateTime;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Exception;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. #[ORM\Entity]
  14. #[ORM\Table(name: 'campaign_wunschjobs_jobseeker_flow_form_databags')]
  15. class JobseekerFlowFormDatabag
  16. {
  17. /**
  18. * @throws Exception
  19. */
  20. public function __construct()
  21. {
  22. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  23. }
  24. #[ORM\Id]
  25. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  26. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  27. #[ORM\Column(
  28. type: Types::GUID,
  29. unique: true
  30. )]
  31. private ?string $id = null;
  32. public function getId(): ?string
  33. {
  34. return $this->id;
  35. }
  36. #[ORM\Column(
  37. type: Types::DATETIME_MUTABLE,
  38. nullable: false
  39. )]
  40. private DateTime $createdAt;
  41. public function setcreatedAt(DateTime $createdAt): void
  42. {
  43. $this->createdAt = $createdAt;
  44. }
  45. public function getcreatedAt(): DateTime
  46. {
  47. return $this->createdAt;
  48. }
  49. #[Assert\NotBlank(
  50. message: 'Bitte gib eine Berufsbezeichnung ein.',
  51. groups: ['step1'])
  52. ]
  53. #[AppAssert\LatinWord(groups: ['step1'])]
  54. #[ORM\Column(
  55. type: Types::STRING,
  56. length: 1024,
  57. nullable: false
  58. )]
  59. private ?string $what = null;
  60. public function getWhat(): ?string
  61. {
  62. return $this->what;
  63. }
  64. public function setWhat(
  65. string $what
  66. ): void {
  67. $this->what = $what;
  68. }
  69. #[Assert\NotBlank(
  70. message: 'Bitte gib eine Postleitzahl ein.',
  71. groups: ['step1'])
  72. ]
  73. #[AppAssert\KnownZipcode(
  74. message : 'Diese PLZ ist uns leider nicht bekannt.',
  75. zipcodeIsAtStartOfString: true,
  76. groups : ['step1']
  77. )]
  78. #[ORM\Column(
  79. type: Types::STRING,
  80. length: 1024,
  81. nullable: false
  82. )]
  83. private ?string $location = null;
  84. public function getLocation(): ?string
  85. {
  86. return $this->location;
  87. }
  88. public function setLocation(
  89. string $location
  90. ): void {
  91. $this->location = $location;
  92. }
  93. public function getLocationZipcode(): ?string
  94. {
  95. if (is_null($this->location)) {
  96. return null;
  97. }
  98. return mb_substr($this->location, 0, 5);
  99. }
  100. #[Assert\Choice(
  101. choices: ZipcodeRadiusesValue::ALL,
  102. groups: ['step1']
  103. )]
  104. #[ORM\Column(
  105. type: Types::SMALLINT,
  106. nullable: false
  107. )]
  108. private int $circumcircle = ZipcodeRadiusesValue::DEFAULT;
  109. public function getCircumcircle(): int
  110. {
  111. return $this->circumcircle;
  112. }
  113. public function setCircumcircle(
  114. int $circumcircle
  115. ): void {
  116. $this->circumcircle = $circumcircle;
  117. }
  118. #[Assert\NotBlank(
  119. message: 'Bitte gib einen Vornamen ein',
  120. groups: ['step2']
  121. )]
  122. #[AppAssert\LatinWord(groups: ['step2'])]
  123. #[ORM\Column(
  124. type: Types::STRING,
  125. length: 1024,
  126. nullable: true
  127. )]
  128. private ?string $firstname = null;
  129. public function getFirstname(): ?string
  130. {
  131. return $this->firstname;
  132. }
  133. public function setFirstname(
  134. string $firstname
  135. ): void {
  136. $this->firstname = $firstname;
  137. }
  138. #[Assert\NotBlank(
  139. message: 'Bitte gib einen Nachnamen ein',
  140. groups: ['step2']
  141. )]
  142. #[AppAssert\LatinWord(groups: ['step2'])]
  143. #[ORM\Column(
  144. type: Types::STRING,
  145. length: 1024,
  146. nullable: true
  147. )]
  148. private ?string $lastname = null;
  149. public function getLastname(): ?string
  150. {
  151. return $this->lastname;
  152. }
  153. public function setLastname(
  154. string $lastname
  155. ): void {
  156. $this->lastname = $lastname;
  157. }
  158. #[Assert\NotBlank(
  159. message: 'Bitte gib eine E-Mail Adresse ein',
  160. groups: ['step2']
  161. )]
  162. #[AppAssert\Email(groups: ['step2'])]
  163. #[ORM\Column(
  164. type: Types::STRING,
  165. length: 1024,
  166. nullable: true
  167. )]
  168. private ?string $email = null;
  169. public function getEmail(): ?string
  170. {
  171. return $this->email;
  172. }
  173. public function setEmail(
  174. string $email
  175. ): void {
  176. $this->email = $email;
  177. }
  178. #[Assert\NotBlank(
  179. message: 'Mit einer Telefonnummer können Arbeitgeber dich schneller kontaktieren.',
  180. groups : ['step2']
  181. )]
  182. #[Assert\Regex(
  183. pattern: "/^[ +\-\/0-9]{6,30}$/",
  184. message: 'Bitte geben Sie eine gültige Telefonnummer ein.',
  185. groups : ['step2']
  186. )]
  187. #[ORM\Column(
  188. type: Types::STRING,
  189. length: 1024,
  190. nullable: true
  191. )]
  192. private ?string $phone = null;
  193. public function getPhone(): ?string
  194. {
  195. return $this->phone;
  196. }
  197. public function setPhone(
  198. string $phone
  199. ): void {
  200. $this->phone = $phone;
  201. }
  202. #[ORM\ManyToOne(
  203. targetEntity: JobseekerProfile::class,
  204. cascade: ['persist']
  205. )]
  206. #[ORM\JoinColumn(
  207. name: 'jobseeker_profiles_id',
  208. referencedColumnName: 'id',
  209. nullable: true,
  210. onDelete: 'SET NULL'
  211. )]
  212. private ?JobseekerProfile $jobseekerProfile;
  213. public function setJobseekerProfile(?JobseekerProfile $jobseekerProfile): void
  214. {
  215. $this->jobseekerProfile = $jobseekerProfile;
  216. }
  217. public function getJobseekerProfile(): ?JobseekerProfile
  218. {
  219. return $this->jobseekerProfile;
  220. }
  221. }