src/Entity/Cvs/Jobs.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Cvs;
  3. use App\Entity\Core\Users;
  4. use App\Entity\Core\Agencies;
  5. use Doctrine\DBAL\Types\Types;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Symfony\Component\HttpFoundation\File\File;
  11. use Symfony\Component\HttpFoundation\File\UploadedFile;
  12. use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  13. use Vich\UploaderBundle\Templating\Helper\UploaderHelper;
  14. /**
  15. * Jobs - Offre d'emploi.
  16. *
  17. * @ORM\Table(name="cvs_jobs", indexes={
  18. * @ORM\Index(name="idx_jobs_listing", columns={"online", "locale", "created_at"}),
  19. * @ORM\Index(name="idx_jobs_category", columns={"category"}),
  20. * @ORM\Index(name="idx_jobs_slug", columns={"slug"})
  21. * })
  22. * @ORM\Entity(repositoryClass="App\Repository\Cvs\JobsRepository")
  23. * @ORM\HasLifecycleCallbacks()
  24. * @Vich\Uploadable
  25. */
  26. class Jobs
  27. {
  28. /**
  29. * @var integer
  30. *
  31. * @ORM\Column(name="id", type="integer")
  32. * @ORM\Id
  33. * @ORM\GeneratedValue(strategy="AUTO")
  34. */
  35. protected $id;
  36. /**
  37. * @var string
  38. *
  39. * @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
  40. */
  41. private $createdAt;
  42. /**
  43. * @var string
  44. *
  45. * @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
  46. */
  47. private $updatedAt;
  48. /**
  49. * @var string
  50. *
  51. * @ORM\Column(name="jobtitle", type="string", length=255, nullable=true)
  52. */
  53. private $jobTitle;
  54. /**
  55. * @var string
  56. *
  57. * @ORM\Column(name="category", type="string", length=255, nullable=true)
  58. */
  59. private $category;
  60. /**
  61. * @var string
  62. *
  63. * @ORM\Column(name="employment_type", type="string", length=255, nullable=true)
  64. */
  65. private $employmentType;
  66. /**
  67. * @var string
  68. *
  69. * @ORM\Column(name="experience_level", type="string", length=255, nullable=true)
  70. */
  71. private $experienceLevel;
  72. /**
  73. * @var string
  74. *
  75. * @ORM\Column(name="remote_work", type="string", length=255, nullable=true)
  76. */
  77. private $remoteWork;
  78. /**
  79. * @var string
  80. *
  81. * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
  82. */
  83. private $companyName;
  84. /**
  85. * @var string
  86. *
  87. * @ORM\Column(name="company_size", type="string", length=255, nullable=true)
  88. */
  89. private $companySize;
  90. /**
  91. * @var string
  92. *
  93. * @ORM\Column(name="short_title", type="text", nullable=true)
  94. */
  95. private $shortTitle;
  96. /**
  97. * @var string
  98. *
  99. * @ORM\Column(name="short_description", type="text", nullable=true)
  100. */
  101. private $shortDescription;
  102. /**
  103. * @var string
  104. *
  105. * @ORM\Column(name="address", type="string", length=255, nullable=true)
  106. */
  107. private $address;
  108. /**
  109. * @var string
  110. *
  111. * @ORM\Column(name="city", type="string", length=255, nullable=true)
  112. */
  113. private $city;
  114. /**
  115. * @var string
  116. *
  117. * @ORM\Column(name="zipcode", type="string", length=255, nullable=true)
  118. */
  119. private $zipcode;
  120. /**
  121. * @var string
  122. *
  123. * @ORM\Column(name="country", type="string", length=255, nullable=true)
  124. */
  125. private $country;
  126. /**
  127. * @var string
  128. *
  129. * @ORM\Column(name="website", type="string", length=255, nullable=true)
  130. */
  131. private $website;
  132. /**
  133. * @var string
  134. *
  135. * @ORM\Column(name="email", type="string", length=255, nullable=true)
  136. */
  137. private $email;
  138. /**
  139. * @var string
  140. *
  141. * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  142. */
  143. private $phone;
  144. /**
  145. * @var string
  146. *
  147. * @ORM\Column(name="company_description", type="text", nullable=true)
  148. */
  149. private $companyDescription;
  150. /**
  151. * @var string
  152. *
  153. * @ORM\Column(name="required_skills", type="text", nullable=true)
  154. */
  155. private $requiredSkills;
  156. /**
  157. * @var string
  158. *
  159. * @ORM\Column(name="nice_to_have_skills", type="text", nullable=true)
  160. */
  161. private $niceToHaveSkills;
  162. /**
  163. * @var string
  164. *
  165. * @ORM\Column(name="job_summary", type="text", nullable=true)
  166. */
  167. private $jobSummary;
  168. /**
  169. * @var string
  170. *
  171. * @ORM\Column(name="key_responsabilities", type="text", nullable=true)
  172. */
  173. private $keyResponsabilities;
  174. /**
  175. * @var string
  176. *
  177. * @ORM\Column(name="requirements", type="text", nullable=true)
  178. */
  179. private $requirements;
  180. /**
  181. * @var string
  182. *
  183. * @ORM\Column(name="salary_min", type="integer", length=11, nullable=true)
  184. */
  185. private $salaryMin;
  186. /**
  187. * @var string
  188. *
  189. * @ORM\Column(name="salary_max", type="integer", length=11, nullable=true)
  190. */
  191. private $salaryMax;
  192. /**
  193. * @var string
  194. *
  195. * @ORM\Column(name="devise", type="string", length=255, nullable=true)
  196. */
  197. private $devise;
  198. /**
  199. * @var string
  200. *
  201. * @ORM\Column(name="salary_period", type="string", length=255, nullable=true)
  202. */
  203. private $salaryPeriod;
  204. /**
  205. * @var string
  206. *
  207. * @ORM\Column(name="benefits", type="text", nullable=true)
  208. */
  209. private $benefits;
  210. /**
  211. * @var string
  212. *
  213. * @ORM\Column(name="contact_name", type="string", length=255, nullable=true)
  214. */
  215. private $contactName;
  216. /**
  217. * @var string
  218. *
  219. * @ORM\Column(name="contact_email", type="string", length=255, nullable=true)
  220. */
  221. private $contactEmail;
  222. /**
  223. * @var string
  224. *
  225. * @ORM\Column(name="contact_url", type="string", length=255, nullable=true)
  226. */
  227. private $contactURL;
  228. /**
  229. * NOTE: This is not a mapped field of entity metadata, just a simple property.
  230. *
  231. * @Vich\UploadableField(mapping="cv_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions")
  232. *
  233. * @var File|null
  234. */
  235. private $imageFile;
  236. /**
  237. * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  238. *
  239. * @var EmbeddedFile
  240. */
  241. private $image;
  242. /**
  243. * @var string
  244. *
  245. * @ORM\Column(name="online", type="boolean", nullable=true)
  246. */
  247. private $online;
  248. /**
  249. * @var \Users
  250. *
  251. * @ORM\ManyToOne(targetEntity="App\Entity\Core\Users")
  252. * @ORM\JoinColumns({
  253. * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
  254. * })
  255. */
  256. protected $user;
  257. /**
  258. * @var string
  259. *
  260. * @ORM\Column(name="slug", type="string", length=255, nullable=true)
  261. */
  262. private $slug;
  263. /**
  264. * @var string
  265. *
  266. * @ORM\Column(name="keywords", type="string", length=255, nullable=true)
  267. */
  268. private $keywords;
  269. /**
  270. * @var string
  271. *
  272. * @ORM\Column(name="locale", type="string", length=255, nullable=true)
  273. */
  274. private $locale;
  275. /**
  276. * @var string
  277. *
  278. * @ORM\Column(name="views", type="integer", length=11, nullable=true)
  279. */
  280. private $views;
  281. /**
  282. * @var string
  283. *
  284. * @ORM\Column(name="validation", type="boolean", nullable=true)
  285. */
  286. private $validation;
  287. /**
  288. * @var string
  289. *
  290. * @ORM\Column(name="verification", type="boolean", nullable=true)
  291. */
  292. private $verification;
  293. /**
  294. * @var \Enterprises
  295. *
  296. * @ORM\ManyToOne(targetEntity="App\Entity\Cvs\Enterprises")
  297. * @ORM\JoinColumns({
  298. * @ORM\JoinColumn(name="enterprise_id", referencedColumnName="id", nullable=true)
  299. * })
  300. */
  301. protected $enterprise;
  302. /**
  303. * @var string
  304. *
  305. * @ORM\Column(name="websearch", type="boolean", nullable=true)
  306. */
  307. private $websearch;
  308. /**
  309. * Paiement effectué pour cette offre.
  310. *
  311. * @ORM\Column(name="paid", type="boolean", nullable=true, options={"default": false})
  312. */
  313. private $paid = false;
  314. /**
  315. * ID de transaction unique lié au paiement (anti-doublon).
  316. * - Stripe : pi_xxx
  317. * - RevenueCat : transactionIdentifier
  318. *
  319. * @ORM\Column(name="paid_transaction_id", type="string", length=255, nullable=true, unique=true)
  320. */
  321. private $paidTransactionId;
  322. /**
  323. * Provider utilisé pour le paiement de cette offre.
  324. *
  325. * @ORM\Column(name="paid_provider", type="string", length=50, nullable=true)
  326. */
  327. private $paidProvider; // 'stripe' | 'revenuecat' | 'premium'
  328. public function __construct()
  329. {
  330. $this->image = new \Vich\UploaderBundle\Entity\File();
  331. }
  332. /**
  333. * @ORM\PrePersist
  334. */
  335. public function setCreatedAtValue(): void
  336. {
  337. $this->setCreatedAt(new \DateTime("now"));
  338. $this->setUpdatedAt(new \DateTime("now"));
  339. }
  340. /**
  341. * @ORM\PreUpdate
  342. */
  343. public function setUpdatedAtValue(): void
  344. {
  345. $this->setUpdatedAt(new \DateTime("now"));
  346. }
  347. public function __toString()
  348. {
  349. return (string)$this->id;
  350. }
  351. /**
  352. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  353. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  354. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  355. * must be able to accept an instance of 'File' as the bundle will inject one here
  356. * during Doctrine hydration.
  357. *
  358. * @param File|UploadedFile|null $imageFile
  359. */
  360. public function setImageFile(?File $imageFile = null)
  361. {
  362. $this->imageFile = $imageFile;
  363. if (null !== $imageFile) {
  364. // It is required that at least one field changes if you are using doctrine
  365. // otherwise the event listeners won't be called and the file is lost
  366. $this->setUpdatedAt(new \DateTime("now"));
  367. }
  368. }
  369. public function getImageFile(): ?File
  370. {
  371. return $this->imageFile;
  372. }
  373. public function setImage(EmbeddedFile $image): void
  374. {
  375. $this->image = $image;
  376. }
  377. public function getImage(): ?EmbeddedFile
  378. {
  379. return $this->image;
  380. }
  381. public function getImageBase64(?string $projectDir = null): ?string
  382. {
  383. if (!$this->image || !$this->image->getName()) {
  384. return null;
  385. }
  386. if (!$projectDir) {
  387. return null; // ou throw new \Exception('Project dir required');
  388. }
  389. $filePath = $projectDir . '/files/cvs/' . $this->image->getName();
  390. if (!file_exists($filePath)) {
  391. return null;
  392. }
  393. $imageData = file_get_contents($filePath);
  394. $mimeType = $this->image->getMimeType() ?? mime_content_type($filePath);
  395. return 'data:' . $mimeType . ';base64,' . base64_encode($imageData);
  396. }
  397. public function getId(): ?int
  398. {
  399. return $this->id;
  400. }
  401. public function getCreatedAt(): ?\DateTimeInterface
  402. {
  403. return $this->createdAt;
  404. }
  405. public function setCreatedAt(?\DateTimeInterface $createdAt): static
  406. {
  407. $this->createdAt = $createdAt;
  408. return $this;
  409. }
  410. public function getUpdatedAt(): ?\DateTimeInterface
  411. {
  412. return $this->updatedAt;
  413. }
  414. public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
  415. {
  416. $this->updatedAt = $updatedAt;
  417. return $this;
  418. }
  419. public function getJobTitle(): ?string
  420. {
  421. return $this->jobTitle;
  422. }
  423. public function setJobTitle(?string $jobTitle): static
  424. {
  425. $this->jobTitle = $jobTitle;
  426. return $this;
  427. }
  428. public function getCategory(): ?string
  429. {
  430. return $this->category;
  431. }
  432. public function setCategory(?string $category): static
  433. {
  434. $this->category = $category;
  435. return $this;
  436. }
  437. public function getEmploymentType(): ?string
  438. {
  439. return $this->employmentType;
  440. }
  441. public function setEmploymentType(?string $employmentType): static
  442. {
  443. $this->employmentType = $employmentType;
  444. return $this;
  445. }
  446. public function getExperienceLevel(): ?string
  447. {
  448. return $this->experienceLevel;
  449. }
  450. public function setExperienceLevel(?string $experienceLevel): static
  451. {
  452. $this->experienceLevel = $experienceLevel;
  453. return $this;
  454. }
  455. public function getRemoteWork(): ?string
  456. {
  457. return $this->remoteWork;
  458. }
  459. public function setRemoteWork(?string $remoteWork): static
  460. {
  461. $this->remoteWork = $remoteWork;
  462. return $this;
  463. }
  464. public function getCompanyName(): ?string
  465. {
  466. return $this->companyName;
  467. }
  468. public function setCompanyName(?string $companyName): static
  469. {
  470. $this->companyName = $companyName;
  471. return $this;
  472. }
  473. public function getAddress(): ?string
  474. {
  475. return $this->address;
  476. }
  477. public function setAddress(?string $address): static
  478. {
  479. $this->address = $address;
  480. return $this;
  481. }
  482. public function getCity(): ?string
  483. {
  484. return $this->city;
  485. }
  486. public function setCity(?string $city): static
  487. {
  488. $this->city = $city;
  489. return $this;
  490. }
  491. public function getZipcode(): ?string
  492. {
  493. return $this->zipcode;
  494. }
  495. public function setZipcode(?string $zipcode): static
  496. {
  497. $this->zipcode = $zipcode;
  498. return $this;
  499. }
  500. public function getCountry(): ?string
  501. {
  502. return $this->country;
  503. }
  504. public function setCountry(?string $country): static
  505. {
  506. $this->country = $country;
  507. return $this;
  508. }
  509. public function getWebsite(): ?string
  510. {
  511. return $this->website;
  512. }
  513. public function setWebsite(?string $website): static
  514. {
  515. $this->website = $website;
  516. return $this;
  517. }
  518. public function getEmail(): ?string
  519. {
  520. return $this->email;
  521. }
  522. public function setEmail(?string $email): static
  523. {
  524. $this->email = $email;
  525. return $this;
  526. }
  527. public function getPhone(): ?string
  528. {
  529. return $this->phone;
  530. }
  531. public function setPhone(?string $phone): static
  532. {
  533. $this->phone = $phone;
  534. return $this;
  535. }
  536. public function getCompanyDescription(): ?string
  537. {
  538. return $this->companyDescription;
  539. }
  540. public function setCompanyDescription(?string $companyDescription): static
  541. {
  542. $this->companyDescription = $companyDescription;
  543. return $this;
  544. }
  545. public function getRequiredSkills(): ?string
  546. {
  547. return $this->requiredSkills;
  548. }
  549. public function setRequiredSkills(?string $requiredSkills): static
  550. {
  551. $this->requiredSkills = $requiredSkills;
  552. return $this;
  553. }
  554. public function getNiceToHaveSkills(): ?string
  555. {
  556. return $this->niceToHaveSkills;
  557. }
  558. public function setNiceToHaveSkills(?string $niceToHaveSkills): static
  559. {
  560. $this->niceToHaveSkills = $niceToHaveSkills;
  561. return $this;
  562. }
  563. public function getJobSummary(): ?string
  564. {
  565. return $this->jobSummary;
  566. }
  567. public function setJobSummary(?string $jobSummary): static
  568. {
  569. $this->jobSummary = $jobSummary;
  570. return $this;
  571. }
  572. public function getKeyResponsabilities(): ?string
  573. {
  574. return $this->keyResponsabilities;
  575. }
  576. public function setKeyResponsabilities(?string $keyResponsabilities): static
  577. {
  578. $this->keyResponsabilities = $keyResponsabilities;
  579. return $this;
  580. }
  581. public function getRequirements(): ?string
  582. {
  583. return $this->requirements;
  584. }
  585. public function setRequirements(?string $requirements): static
  586. {
  587. $this->requirements = $requirements;
  588. return $this;
  589. }
  590. public function getSalaryMin(): ?int
  591. {
  592. return $this->salaryMin;
  593. }
  594. public function setSalaryMin(?int $salaryMin): static
  595. {
  596. $this->salaryMin = $salaryMin;
  597. return $this;
  598. }
  599. public function getSalaryMax(): ?int
  600. {
  601. return $this->salaryMax;
  602. }
  603. public function setSalaryMax(?int $salaryMax): static
  604. {
  605. $this->salaryMax = $salaryMax;
  606. return $this;
  607. }
  608. public function getDevise(): ?string
  609. {
  610. return $this->devise;
  611. }
  612. public function setDevise(?string $devise): static
  613. {
  614. $this->devise = $devise;
  615. return $this;
  616. }
  617. public function getSalaryPeriod(): ?string
  618. {
  619. return $this->salaryPeriod;
  620. }
  621. public function setSalaryPeriod(?string $salaryPeriod): static
  622. {
  623. $this->salaryPeriod = $salaryPeriod;
  624. return $this;
  625. }
  626. public function getBenefits(): ?string
  627. {
  628. return $this->benefits;
  629. }
  630. public function setBenefits(?string $benefits): static
  631. {
  632. $this->benefits = $benefits;
  633. return $this;
  634. }
  635. public function getContactName(): ?string
  636. {
  637. return $this->contactName;
  638. }
  639. public function setContactName(?string $contactName): static
  640. {
  641. $this->contactName = $contactName;
  642. return $this;
  643. }
  644. public function getContactEmail(): ?string
  645. {
  646. return $this->contactEmail;
  647. }
  648. public function setContactEmail(?string $contactEmail): static
  649. {
  650. $this->contactEmail = $contactEmail;
  651. return $this;
  652. }
  653. public function getContactURL(): ?string
  654. {
  655. return $this->contactURL;
  656. }
  657. public function setContactURL(?string $contactURL): static
  658. {
  659. $this->contactURL = $contactURL;
  660. return $this;
  661. }
  662. public function isOnline(): ?bool
  663. {
  664. return $this->online;
  665. }
  666. public function setOnline(?bool $online): static
  667. {
  668. $this->online = $online;
  669. return $this;
  670. }
  671. public function getUser(): ?Users
  672. {
  673. return $this->user;
  674. }
  675. public function setUser(?Users $user): static
  676. {
  677. $this->user = $user;
  678. return $this;
  679. }
  680. public function getSlug(): ?string
  681. {
  682. return $this->slug;
  683. }
  684. public function setSlug(?string $slug): static
  685. {
  686. $this->slug = $slug;
  687. return $this;
  688. }
  689. public function getLocale(): ?string
  690. {
  691. return $this->locale;
  692. }
  693. public function setLocale(?string $locale): static
  694. {
  695. $this->locale = $locale;
  696. return $this;
  697. }
  698. public function getEnterprise(): ?Enterprises
  699. {
  700. return $this->enterprise;
  701. }
  702. public function setEnterprise(?Enterprises $enterprise): static
  703. {
  704. $this->enterprise = $enterprise;
  705. return $this;
  706. }
  707. public function getCompanySize(): ?string
  708. {
  709. return $this->companySize;
  710. }
  711. public function setCompanySize(?string $companySize): static
  712. {
  713. $this->companySize = $companySize;
  714. return $this;
  715. }
  716. public function isValidation(): ?bool
  717. {
  718. return $this->validation;
  719. }
  720. public function setValidation(?bool $validation): static
  721. {
  722. $this->validation = $validation;
  723. return $this;
  724. }
  725. public function getShortTitle(): ?string
  726. {
  727. return $this->shortTitle;
  728. }
  729. public function setShortTitle(?string $shortTitle): static
  730. {
  731. $this->shortTitle = $shortTitle;
  732. return $this;
  733. }
  734. public function getShortDescription(): ?string
  735. {
  736. return $this->shortDescription;
  737. }
  738. public function setShortDescription(?string $shortDescription): static
  739. {
  740. $this->shortDescription = $shortDescription;
  741. return $this;
  742. }
  743. public function getViews(): ?int
  744. {
  745. return $this->views;
  746. }
  747. public function setViews(?int $views): static
  748. {
  749. $this->views = $views;
  750. return $this;
  751. }
  752. public function isVerification(): ?bool
  753. {
  754. return $this->verification;
  755. }
  756. public function setVerification(?bool $verification): static
  757. {
  758. $this->verification = $verification;
  759. return $this;
  760. }
  761. public function isWebsearch(): ?bool
  762. {
  763. return $this->websearch;
  764. }
  765. public function setWebsearch(?bool $websearch): static
  766. {
  767. $this->websearch = $websearch;
  768. return $this;
  769. }
  770. public function getKeywords(): ?string
  771. {
  772. return $this->keywords;
  773. }
  774. public function setKeywords(?string $keywords): static
  775. {
  776. $this->keywords = $keywords;
  777. return $this;
  778. }
  779. public function isPaid(): ?bool { return $this->paid; }
  780. public function setPaid(?bool $paid): static { $this->paid = $paid; return $this; }
  781. public function getPaidTransactionId(): ?string { return $this->paidTransactionId; }
  782. public function setPaidTransactionId(?string $id): static { $this->paidTransactionId = $id; return $this; }
  783. public function getPaidProvider(): ?string { return $this->paidProvider; }
  784. public function setPaidProvider(?string $provider): static { $this->paidProvider = $provider; return $this; }
  785. }