src/Entity/Cvs/Jobs.php line 25

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