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="address", type="string", length=255, nullable=true)
  90.      */
  91.     private $address;
  92.     /**
  93.      * @var string
  94.      *
  95.      * @ORM\Column(name="city", type="string", length=255, nullable=true)
  96.      */
  97.     private $city;
  98.     /**
  99.      * @var string
  100.      *
  101.      * @ORM\Column(name="zipcode", type="string", length=255, nullable=true)
  102.      */
  103.     private $zipcode;
  104.     /**
  105.      * @var string
  106.      *
  107.      * @ORM\Column(name="country", type="string", length=255, nullable=true)
  108.      */
  109.     private $country;
  110.     /**
  111.      * @var string
  112.      *
  113.      * @ORM\Column(name="website", type="string", length=255, nullable=true)
  114.      */
  115.     private $website;
  116.     /**
  117.      * @var string
  118.      *
  119.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  120.      */
  121.     private $email;
  122.     /**
  123.      * @var string
  124.      *
  125.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  126.      */
  127.     private $phone;
  128.     /**
  129.      * @var string
  130.      *
  131.      * @ORM\Column(name="company_description", type="text", nullable=true)
  132.      */
  133.     private $companyDescription;
  134.     /**
  135.      * @var string
  136.      *
  137.      * @ORM\Column(name="required_skills", type="text", nullable=true)
  138.      */
  139.     private $requiredSkills;
  140.     /**
  141.      * @var string
  142.      *
  143.      * @ORM\Column(name="nice_to_have_skills", type="text", nullable=true)
  144.      */
  145.     private $niceToHaveSkills;
  146.     /**
  147.      * @var string
  148.      *
  149.      * @ORM\Column(name="job_summary", type="text", nullable=true)
  150.      */
  151.     private $jobSummary;
  152.     /**
  153.      * @var string
  154.      *
  155.      * @ORM\Column(name="key_responsabilities", type="text", nullable=true)
  156.      */
  157.     private $keyResponsabilities;
  158.     /**
  159.      * @var string
  160.      *
  161.      * @ORM\Column(name="requirements", type="text", nullable=true)
  162.      */
  163.     private $requirements;
  164.     /**
  165.      * @var string
  166.      *
  167.      * @ORM\Column(name="salary_min", type="integer", length=11, nullable=true)
  168.      */
  169.     private $salaryMin;
  170.     /**
  171.      * @var string
  172.      *
  173.      * @ORM\Column(name="salary_max", type="integer", length=11, nullable=true)
  174.      */
  175.     private $salaryMax;
  176.     /**
  177.      * @var string
  178.      *
  179.      * @ORM\Column(name="devise", type="string", length=255, nullable=true)
  180.      */
  181.     private $devise;
  182.     /**
  183.      * @var string
  184.      *
  185.      * @ORM\Column(name="salary_period", type="string", length=255, nullable=true)
  186.      */
  187.     private $salaryPeriod;
  188.     /**
  189.      * @var string
  190.      *
  191.      * @ORM\Column(name="benefits", type="text", nullable=true)
  192.      */
  193.     private $benefits;
  194.     /**
  195.      * @var string
  196.      *
  197.      * @ORM\Column(name="contact_name", type="string", length=255, nullable=true)
  198.      */
  199.     private $contactName;
  200.     /**
  201.      * @var string
  202.      *
  203.      * @ORM\Column(name="contact_email", type="string", length=255, nullable=true)
  204.      */
  205.     private $contactEmail;
  206.     /**
  207.      * @var string
  208.      *
  209.      * @ORM\Column(name="contact_url", type="string", length=255, nullable=true)
  210.      */
  211.     private $contactURL;
  212.     /**
  213.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  214.      *
  215.      * @Vich\UploadableField(mapping="cv_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions")
  216.      *
  217.      * @var File|null
  218.      */
  219.     private $imageFile;
  220.     /**
  221.      * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  222.      *
  223.      * @var EmbeddedFile
  224.      */
  225.     private $image;
  226.     /**
  227.      * @var string
  228.      *
  229.      * @ORM\Column(name="online", type="boolean", nullable=true)
  230.      */
  231.     private $online;
  232.     /**
  233.      * @var \Users
  234.      *
  235.      * @ORM\ManyToOne(targetEntity="App\Entity\Core\Users")
  236.      * @ORM\JoinColumns({
  237.      *   @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
  238.      * })
  239.      */
  240.     protected $user;
  241.     /**
  242.      * @var string
  243.      *
  244.      * @ORM\Column(name="slug", type="string", length=255, nullable=true)
  245.      */
  246.     private $slug;
  247.     /**
  248.      * @var string
  249.      *
  250.      * @ORM\Column(name="locale", type="string", length=255, nullable=true)
  251.      */
  252.     private $locale;
  253.     /**
  254.      * @var \Enterprises
  255.      *
  256.      * @ORM\ManyToOne(targetEntity="App\Entity\Cvs\Enterprises")
  257.      * @ORM\JoinColumns({
  258.      *   @ORM\JoinColumn(name="enterprise_id", referencedColumnName="id", nullable=true)
  259.      * })
  260.      */
  261.     protected $enterprise;
  262.     public function __construct()
  263.     {
  264.         $this->image = new \Vich\UploaderBundle\Entity\File();
  265.     }
  266.     /**
  267.      * @ORM\PrePersist
  268.      */
  269.     public function setCreatedAtValue(): void
  270.     {
  271.         $this->setCreatedAt(new \DateTime("now"));
  272.         $this->setUpdatedAt(new \DateTime("now"));
  273.     }
  274.     /**
  275.      * @ORM\PreUpdate
  276.      */
  277.     public function setUpdatedAtValue(): void
  278.     {
  279.         $this->setUpdatedAt(new \DateTime("now"));
  280.     }
  281.     public function __toString()
  282.     {
  283.         return (string)$this->id;
  284.     }
  285.     /**
  286.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  287.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  288.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  289.      * must be able to accept an instance of 'File' as the bundle will inject one here
  290.      * during Doctrine hydration.
  291.      *
  292.      * @param File|UploadedFile|null $imageFile
  293.      */
  294.     public function setImageFile(?File $imageFile null)
  295.     {
  296.         $this->imageFile $imageFile;
  297.         if (null !== $imageFile) {
  298.             // It is required that at least one field changes if you are using doctrine
  299.             // otherwise the event listeners won't be called and the file is lost
  300.             $this->setUpdatedAt(new \DateTime("now"));
  301.         }
  302.     }
  303.     public function getImageFile(): ?File
  304.     {
  305.         return $this->imageFile;
  306.     }
  307.     public function setImage(EmbeddedFile $image): void
  308.     {
  309.         $this->image $image;
  310.     }
  311.     public function getImage(): ?EmbeddedFile
  312.     {
  313.         return $this->image;
  314.     }
  315.     public function getImageBase64(?string $projectDir null): ?string
  316.     {
  317.         if (!$this->image || !$this->image->getName()) {
  318.             return null;
  319.         }
  320.         if (!$projectDir) {
  321.             return null// ou throw new \Exception('Project dir required');
  322.         }
  323.         $filePath $projectDir '/files/cvs/' $this->image->getName();
  324.         if (!file_exists($filePath)) {
  325.             return null;
  326.         }
  327.         $imageData file_get_contents($filePath);
  328.         $mimeType $this->image->getMimeType() ?? mime_content_type($filePath);
  329.         return 'data:' $mimeType ';base64,' base64_encode($imageData);
  330.     }
  331.     public function getId(): ?int
  332.     {
  333.         return $this->id;
  334.     }
  335.     public function getCreatedAt(): ?\DateTimeInterface
  336.     {
  337.         return $this->createdAt;
  338.     }
  339.     public function setCreatedAt(?\DateTimeInterface $createdAt): static
  340.     {
  341.         $this->createdAt $createdAt;
  342.         return $this;
  343.     }
  344.     public function getUpdatedAt(): ?\DateTimeInterface
  345.     {
  346.         return $this->updatedAt;
  347.     }
  348.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
  349.     {
  350.         $this->updatedAt $updatedAt;
  351.         return $this;
  352.     }
  353.     public function getJobTitle(): ?string
  354.     {
  355.         return $this->jobTitle;
  356.     }
  357.     public function setJobTitle(?string $jobTitle): static
  358.     {
  359.         $this->jobTitle $jobTitle;
  360.         return $this;
  361.     }
  362.     public function getCategory(): ?string
  363.     {
  364.         return $this->category;
  365.     }
  366.     public function setCategory(?string $category): static
  367.     {
  368.         $this->category $category;
  369.         return $this;
  370.     }
  371.     public function getEmploymentType(): ?string
  372.     {
  373.         return $this->employmentType;
  374.     }
  375.     public function setEmploymentType(?string $employmentType): static
  376.     {
  377.         $this->employmentType $employmentType;
  378.         return $this;
  379.     }
  380.     public function getExperienceLevel(): ?string
  381.     {
  382.         return $this->experienceLevel;
  383.     }
  384.     public function setExperienceLevel(?string $experienceLevel): static
  385.     {
  386.         $this->experienceLevel $experienceLevel;
  387.         return $this;
  388.     }
  389.     public function getRemoteWork(): ?string
  390.     {
  391.         return $this->remoteWork;
  392.     }
  393.     public function setRemoteWork(?string $remoteWork): static
  394.     {
  395.         $this->remoteWork $remoteWork;
  396.         return $this;
  397.     }
  398.     public function getCompanyName(): ?string
  399.     {
  400.         return $this->companyName;
  401.     }
  402.     public function setCompanyName(?string $companyName): static
  403.     {
  404.         $this->companyName $companyName;
  405.         return $this;
  406.     }
  407.     public function getAddress(): ?string
  408.     {
  409.         return $this->address;
  410.     }
  411.     public function setAddress(?string $address): static
  412.     {
  413.         $this->address $address;
  414.         return $this;
  415.     }
  416.     public function getCity(): ?string
  417.     {
  418.         return $this->city;
  419.     }
  420.     public function setCity(?string $city): static
  421.     {
  422.         $this->city $city;
  423.         return $this;
  424.     }
  425.     public function getZipcode(): ?string
  426.     {
  427.         return $this->zipcode;
  428.     }
  429.     public function setZipcode(?string $zipcode): static
  430.     {
  431.         $this->zipcode $zipcode;
  432.         return $this;
  433.     }
  434.     public function getCountry(): ?string
  435.     {
  436.         return $this->country;
  437.     }
  438.     public function setCountry(?string $country): static
  439.     {
  440.         $this->country $country;
  441.         return $this;
  442.     }
  443.     public function getWebsite(): ?string
  444.     {
  445.         return $this->website;
  446.     }
  447.     public function setWebsite(?string $website): static
  448.     {
  449.         $this->website $website;
  450.         return $this;
  451.     }
  452.     public function getEmail(): ?string
  453.     {
  454.         return $this->email;
  455.     }
  456.     public function setEmail(?string $email): static
  457.     {
  458.         $this->email $email;
  459.         return $this;
  460.     }
  461.     public function getPhone(): ?string
  462.     {
  463.         return $this->phone;
  464.     }
  465.     public function setPhone(?string $phone): static
  466.     {
  467.         $this->phone $phone;
  468.         return $this;
  469.     }
  470.     public function getCompanyDescription(): ?string
  471.     {
  472.         return $this->companyDescription;
  473.     }
  474.     public function setCompanyDescription(?string $companyDescription): static
  475.     {
  476.         $this->companyDescription $companyDescription;
  477.         return $this;
  478.     }
  479.     public function getRequiredSkills(): ?string
  480.     {
  481.         return $this->requiredSkills;
  482.     }
  483.     public function setRequiredSkills(?string $requiredSkills): static
  484.     {
  485.         $this->requiredSkills $requiredSkills;
  486.         return $this;
  487.     }
  488.     public function getNiceToHaveSkills(): ?string
  489.     {
  490.         return $this->niceToHaveSkills;
  491.     }
  492.     public function setNiceToHaveSkills(?string $niceToHaveSkills): static
  493.     {
  494.         $this->niceToHaveSkills $niceToHaveSkills;
  495.         return $this;
  496.     }
  497.     public function getJobSummary(): ?string
  498.     {
  499.         return $this->jobSummary;
  500.     }
  501.     public function setJobSummary(?string $jobSummary): static
  502.     {
  503.         $this->jobSummary $jobSummary;
  504.         return $this;
  505.     }
  506.     public function getKeyResponsabilities(): ?string
  507.     {
  508.         return $this->keyResponsabilities;
  509.     }
  510.     public function setKeyResponsabilities(?string $keyResponsabilities): static
  511.     {
  512.         $this->keyResponsabilities $keyResponsabilities;
  513.         return $this;
  514.     }
  515.     public function getRequirements(): ?string
  516.     {
  517.         return $this->requirements;
  518.     }
  519.     public function setRequirements(?string $requirements): static
  520.     {
  521.         $this->requirements $requirements;
  522.         return $this;
  523.     }
  524.     public function getSalaryMin(): ?int
  525.     {
  526.         return $this->salaryMin;
  527.     }
  528.     public function setSalaryMin(?int $salaryMin): static
  529.     {
  530.         $this->salaryMin $salaryMin;
  531.         return $this;
  532.     }
  533.     public function getSalaryMax(): ?int
  534.     {
  535.         return $this->salaryMax;
  536.     }
  537.     public function setSalaryMax(?int $salaryMax): static
  538.     {
  539.         $this->salaryMax $salaryMax;
  540.         return $this;
  541.     }
  542.     public function getDevise(): ?string
  543.     {
  544.         return $this->devise;
  545.     }
  546.     public function setDevise(?string $devise): static
  547.     {
  548.         $this->devise $devise;
  549.         return $this;
  550.     }
  551.     public function getSalaryPeriod(): ?string
  552.     {
  553.         return $this->salaryPeriod;
  554.     }
  555.     public function setSalaryPeriod(?string $salaryPeriod): static
  556.     {
  557.         $this->salaryPeriod $salaryPeriod;
  558.         return $this;
  559.     }
  560.     public function getBenefits(): ?string
  561.     {
  562.         return $this->benefits;
  563.     }
  564.     public function setBenefits(?string $benefits): static
  565.     {
  566.         $this->benefits $benefits;
  567.         return $this;
  568.     }
  569.     public function getContactName(): ?string
  570.     {
  571.         return $this->contactName;
  572.     }
  573.     public function setContactName(?string $contactName): static
  574.     {
  575.         $this->contactName $contactName;
  576.         return $this;
  577.     }
  578.     public function getContactEmail(): ?string
  579.     {
  580.         return $this->contactEmail;
  581.     }
  582.     public function setContactEmail(?string $contactEmail): static
  583.     {
  584.         $this->contactEmail $contactEmail;
  585.         return $this;
  586.     }
  587.     public function getContactURL(): ?string
  588.     {
  589.         return $this->contactURL;
  590.     }
  591.     public function setContactURL(?string $contactURL): static
  592.     {
  593.         $this->contactURL $contactURL;
  594.         return $this;
  595.     }
  596.     public function isOnline(): ?bool
  597.     {
  598.         return $this->online;
  599.     }
  600.     public function setOnline(?bool $online): static
  601.     {
  602.         $this->online $online;
  603.         return $this;
  604.     }
  605.     public function getUser(): ?Users
  606.     {
  607.         return $this->user;
  608.     }
  609.     public function setUser(?Users $user): static
  610.     {
  611.         $this->user $user;
  612.         return $this;
  613.     }
  614.     public function getSlug(): ?string
  615.     {
  616.         return $this->slug;
  617.     }
  618.     public function setSlug(?string $slug): static
  619.     {
  620.         $this->slug $slug;
  621.         return $this;
  622.     }
  623.     public function getLocale(): ?string
  624.     {
  625.         return $this->locale;
  626.     }
  627.     public function setLocale(?string $locale): static
  628.     {
  629.         $this->locale $locale;
  630.         return $this;
  631.     }
  632.     public function getEnterprise(): ?Enterprises
  633.     {
  634.         return $this->enterprise;
  635.     }
  636.     public function setEnterprise(?Enterprises $enterprise): static
  637.     {
  638.         $this->enterprise $enterprise;
  639.         return $this;
  640.     }
  641.     public function getCompanySize(): ?string
  642.     {
  643.         return $this->companySize;
  644.     }
  645.     public function setCompanySize(?string $companySize): static
  646.     {
  647.         $this->companySize $companySize;
  648.         return $this;
  649.     }
  650. }