src/Entity/JobConfiguration/Job.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity\JobConfiguration;
  3. use App\Entity\AssocUserJobMyJobGlasses;
  4. use App\Entity\Configuration\JobContract;
  5. use App\Entity\DateTrait;
  6. use App\Entity\User;
  7. use App\Entity\Profil\Profil;
  8. use App\Entity\LinkedinProfile;
  9. use App\Entity\EntityIdentifier;
  10. use App\Entity\UserJobAlgo;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use App\Entity\AssocUserJobLinkedin;
  13. use App\Entity\RecruterDreaminJob\Society;
  14. use Doctrine\Common\Collections\Collection;
  15. use App\Entity\RecruterDreaminJob\Interview;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Knp\DoctrineBehaviors\Model as ORMBehaviors;
  18. use Symfony\Component\Serializer\Annotation\Groups;
  19. use App\Entity\JobConfiguration\Job\JobAssignment;
  20. use App\Repository\JobConfiguration\JobRepository;
  21. use App\Entity\Configuration\School\Formation\Formation;
  22. use App\Entity\JobConfiguration\Job\Favorites\Favorites;
  23. use App\Enum\JobStatutEnum;
  24. /**
  25.  * @ORM\Entity(repositoryClass=JobRepository::class)
  26.  * @ORM\HasLifecycleCallbacks()
  27.  */
  28. class Job
  29. {
  30.     use ORMBehaviors\Translatable\Translatable;
  31.     
  32.     use EntityIdentifier;
  33.     
  34.     use DateTrait;
  35.     
  36.     /**
  37.      * @ORM\Id
  38.      * @ORM\GeneratedValue
  39.      * @ORM\Column(type="integer")
  40.      * @Groups({"badge_cv"})
  41.      */
  42.     private $id;
  43.     
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=JobTranslation::class, mappedBy="translatable", cascade={"persist"})
  46.      */
  47.     protected $newTranslations;
  48.     
  49.     /**
  50.      * @Groups({"badge_cv"})
  51.      */
  52.     protected $translations;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity=JobSubCategory::class, inversedBy="jobs")
  55.      */
  56.     private $jobSubCategory;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobs")
  59.      * @Groups({"badge_cv"})
  60.      */
  61.     private $majorProfile;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobMinors")
  64.      * @Groups({"badge_cv"})
  65.      */
  66.     private $minorProfile;
  67.     /**
  68.      * @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobFairs")
  69.      * @Groups({"badge_cv"})
  70.      */
  71.     private $fair;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      * @Groups({"badge_cv"})
  75.      */
  76.     private $picture;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=JobUserProfile::class, mappedBy="job")
  79.      */
  80.     private $jobUserProfiles;
  81.     /**
  82.      * @ORM\OneToMany(targetEntity=Favorites::class, mappedBy="job")
  83.      */
  84.     private $favorites;
  85.     /**
  86.      * @ORM\OneToMany(targetEntity=LinkedinProfile::class, mappedBy="job")
  87.      */
  88.     private $linkedinProfiles;
  89.     /**
  90.      * @ORM\OneToMany(targetEntity=JobUserProfile::class, mappedBy="previousJob")
  91.      */
  92.     private $previousJobOfUsers;
  93.     /**
  94.      * @ORM\ManyToMany(targetEntity=Job::class)
  95.      */
  96.     private $suggestionJobs;
  97.     /**
  98.      * @ORM\ManyToMany(targetEntity=User::class, mappedBy="experiencesJob")
  99.      */
  100.     private $usersWithThisJobAsExperiences;
  101.     /**
  102.      * @ORM\OneToMany(targetEntity=AssocUserJobLinkedin::class, mappedBy="job")
  103.      */
  104.     private $assocUserJobLinkedins;
  105.     /**
  106.      * @ORM\ManyToMany(targetEntity=Job::class, inversedBy="affinityParents")
  107.      * @ORM\JoinTable(name="job_affinity_job")
  108.      */
  109.     private $affinityJobs;
  110.     /**
  111.      * @ORM\ManyToMany(targetEntity=Job::class, mappedBy="affinityJobs")
  112.      */
  113.     private $affinityParents;
  114.     /**
  115.      * @ORM\ManyToMany(targetEntity=JobAssignment::class, inversedBy="jobs")
  116.      */
  117.     private $jobAssignments;
  118.     /**
  119.      * @ORM\ManyToMany(targetEntity=Formation::class, inversedBy="jobs")
  120.      */
  121.     private $formations;
  122.     /**
  123.      * @ORM\ManyToMany(targetEntity=User::class, mappedBy="jobsFoundedCv")
  124.      */
  125.     private $studentsPropertyOfCv;
  126.     /**
  127.      * @ORM\Column(type="string", length=255 , nullable=true, options={"default" : JobStatutEnum::INPROGRESS})
  128.      */
  129.     private $statut ;
  130.     /**
  131.      * @ORM\ManyToOne(targetEntity=JobContract::class)
  132.      */
  133.     private $contract;
  134.     /**
  135.      * @ORM\Column(type="string", length=255, nullable=true)
  136.      */
  137.     private $localization;
  138.     /**
  139.      * @ORM\ManyToOne(targetEntity=User::class)
  140.      */
  141.     private $createdby;
  142.     /**
  143.      * @ORM\OneToMany(targetEntity=UserJobAlgo::class, mappedBy="job")
  144.      */
  145.     private $userJobAlgos;
  146.     /**
  147.      * @ORM\OneToMany(targetEntity=AssocUserJobMyJobGlasses::class, mappedBy="job")
  148.      */
  149.     private $assocUserJobMyJobGlasses;
  150.     /**
  151.      * @ORM\ManyToMany(targetEntity=User::class, mappedBy="validateJobs")
  152.      */
  153.     private $studentsWhoValidateJob;
  154.     public function __construct()
  155.     {
  156.         $this->jobUserProfiles = new ArrayCollection();
  157.         $this->favorites = new ArrayCollection();
  158.         $this->linkedinProfiles = new ArrayCollection();
  159.         $this->previousJobOfUsers = new ArrayCollection();
  160.         $this->suggestionJobs = new ArrayCollection();
  161.         $this->usersWithThisJobAsExperiences = new ArrayCollection();
  162.         $this->assocUserJobLinkedins = new ArrayCollection();
  163.         $this->affinityJobs = new ArrayCollection();
  164.         $this->affinityParents = new ArrayCollection();
  165.         $this->jobAssignments = new ArrayCollection();
  166.         $this->formations = new ArrayCollection();
  167.         $this->studentsPropertyOfCv = new ArrayCollection();
  168.         $this->interviews = new ArrayCollection();
  169.         $this->userJobAlgos = new ArrayCollection();
  170.         $this->assocUserJobMyJobGlasses = new ArrayCollection();
  171.         $this->studentsWhoValidateJob = new ArrayCollection();
  172.     }
  173.     
  174.     /**
  175.      * @ORM\PostLoad()
  176.      */
  177.     public function init() {
  178.                                                                                       $this->mergeNewTranslations();
  179.                                                                                       $this->currentLocale = \Locale::getDefault();
  180.                                                                                   }
  181.     public function getId(): ?int
  182.     {
  183.         return $this->id;
  184.     }
  185.     public function getJobSubCategory(): ?JobSubCategory
  186.     {
  187.         return $this->jobSubCategory;
  188.     }
  189.     public function setJobSubCategory(?JobSubCategory $jobSubCategory): self
  190.     {
  191.         $this->jobSubCategory $jobSubCategory;
  192.         return $this;
  193.     }
  194.     
  195.     public function __call($name$arguments) {
  196.                                                                                       $reflect = new \ReflectionClassJobTranslation::class);
  197.                                                                                       $privateProperties $reflect->getProperties(\ReflectionProperty::IS_PRIVATE);
  198.                                                                                       
  199.                                                                                       foreach ($privateProperties as $property) {
  200.                                                                                           if($property->getName() == $name) {
  201.                                                                                               return $this->translate()->{"get" ucfirst($name)}();
  202.                                                                                           }
  203.                                                                                       }
  204.                                                                                       
  205.                                                                                       return "";
  206.                                                                                   }
  207.     public function getMajorProfile(): ?Profil
  208.     {
  209.         return $this->majorProfile;
  210.     }
  211.     public function setMajorProfile(?Profil $majorProfile): self
  212.     {
  213.         $this->majorProfile $majorProfile;
  214.         return $this;
  215.     }
  216.     public function getMinorProfile(): ?Profil
  217.     {
  218.         return $this->minorProfile;
  219.     }
  220.     public function setMinorProfile(?Profil $minorProfile): self
  221.     {
  222.         $this->minorProfile $minorProfile;
  223.         return $this;
  224.     }
  225.     public function getFair(): ?Profil
  226.     {
  227.         return $this->fair;
  228.     }
  229.     public function setFair(?Profil $fair): self
  230.     {
  231.         $this->fair $fair;
  232.         return $this;
  233.     }
  234.     public function getPicture(): ?string
  235.     {
  236.         return $this->picture;
  237.     }
  238.     public function setPicture(?string $picture): self
  239.     {
  240.         $this->picture $picture;
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return Collection<int, JobUserProfile>
  245.      */
  246.     public function getJobUserProfiles(): Collection
  247.     {
  248.         return $this->jobUserProfiles;
  249.     }
  250.     public function addJobUserProfile(JobUserProfile $jobUserProfile): self
  251.     {
  252.         if (!$this->jobUserProfiles->contains($jobUserProfile)) {
  253.             $this->jobUserProfiles[] = $jobUserProfile;
  254.             $jobUserProfile->setJob($this);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeJobUserProfile(JobUserProfile $jobUserProfile): self
  259.     {
  260.         if ($this->jobUserProfiles->removeElement($jobUserProfile)) {
  261.             // set the owning side to null (unless already changed)
  262.             if ($jobUserProfile->getJob() === $this) {
  263.                 $jobUserProfile->setJob(null);
  264.             }
  265.         }
  266.         return $this;
  267.     }
  268.     /**
  269.      * @return Collection<int, Favorites>
  270.      */
  271.     public function getFavorites(): Collection
  272.     {
  273.         return $this->favorites;
  274.     }
  275.     public function addFavorite(Favorites $favorite): self
  276.     {
  277.         if (!$this->favorites->contains($favorite)) {
  278.             $this->favorites[] = $favorite;
  279.             $favorite->setJob($this);
  280.         }
  281.         return $this;
  282.     }
  283.     public function removeFavorite(Favorites $favorite): self
  284.     {
  285.         if ($this->favorites->removeElement($favorite)) {
  286.             // set the owning side to null (unless already changed)
  287.             if ($favorite->getJob() === $this) {
  288.                 $favorite->setJob(null);
  289.             }
  290.         }
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection<int, LinkedinProfile>
  295.      */
  296.     public function getLinkedinProfiles(): Collection
  297.     {
  298.         return $this->linkedinProfiles;
  299.     }
  300.     public function addLinkedinProfile(LinkedinProfile $linkedinProfile): self
  301.     {
  302.         if (!$this->linkedinProfiles->contains($linkedinProfile)) {
  303.             $this->linkedinProfiles[] = $linkedinProfile;
  304.             $linkedinProfile->setJob($this);
  305.         }
  306.         return $this;
  307.     }
  308.     public function removeLinkedinProfile(LinkedinProfile $linkedinProfile): self
  309.     {
  310.         if ($this->linkedinProfiles->removeElement($linkedinProfile)) {
  311.             // set the owning side to null (unless already changed)
  312.             if ($linkedinProfile->getJob() === $this) {
  313.                 $linkedinProfile->setJob(null);
  314.             }
  315.         }
  316.         return $this;
  317.     }
  318.     /**
  319.      * @return Collection<int, JobUserProfile>
  320.      */
  321.     public function getPreviousJobOfUsers(): Collection
  322.     {
  323.         return $this->previousJobOfUsers;
  324.     }
  325.     public function addPreviousJobOfUser(JobUserProfile $previousJobOfUser): self
  326.     {
  327.         if (!$this->previousJobOfUsers->contains($previousJobOfUser)) {
  328.             $this->previousJobOfUsers[] = $previousJobOfUser;
  329.             $previousJobOfUser->setPreviousJob($this);
  330.         }
  331.         return $this;
  332.     }
  333.     public function removePreviousJobOfUser(JobUserProfile $previousJobOfUser): self
  334.     {
  335.         if ($this->previousJobOfUsers->removeElement($previousJobOfUser)) {
  336.             // set the owning side to null (unless already changed)
  337.             if ($previousJobOfUser->getPreviousJob() === $this) {
  338.                 $previousJobOfUser->setPreviousJob(null);
  339.             }
  340.         }
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return Collection<int, self>
  345.      */
  346.     public function getSuggestionJobs(): Collection
  347.     {
  348.         return $this->suggestionJobs;
  349.     }
  350.     public function addSuggestionJob(self $suggestionJob): self
  351.     {
  352.         if (!$this->suggestionJobs->contains($suggestionJob)) {
  353.             $this->suggestionJobs[] = $suggestionJob;
  354.         }
  355.         return $this;
  356.     }
  357.     public function removeSuggestionJob(self $suggestionJob): self
  358.     {
  359.         $this->suggestionJobs->removeElement($suggestionJob);
  360.         return $this;
  361.     }
  362.     /**
  363.      * @return Collection<int, User>
  364.      */
  365.     public function getUsersWithThisJobAsExperiences(): Collection
  366.     {
  367.         return $this->usersWithThisJobAsExperiences;
  368.     }
  369.     public function addUsersWithThisJobAsExperience(User $usersWithThisJobAsExperience): self
  370.     {
  371.         if (!$this->usersWithThisJobAsExperiences->contains($usersWithThisJobAsExperience)) {
  372.             $this->usersWithThisJobAsExperiences[] = $usersWithThisJobAsExperience;
  373.             $usersWithThisJobAsExperience->addExperiencesJob($this);
  374.         }
  375.         return $this;
  376.     }
  377.     public function removeUsersWithThisJobAsExperience(User $usersWithThisJobAsExperience): self
  378.     {
  379.         if ($this->usersWithThisJobAsExperiences->removeElement($usersWithThisJobAsExperience)) {
  380.             $usersWithThisJobAsExperience->removeExperiencesJob($this);
  381.         }
  382.         return $this;
  383.     }
  384.     /**
  385.      * @return Collection<int, AssocUserJobLinkedin>
  386.      */
  387.     public function getAssocUserJobLinkedins(): Collection
  388.     {
  389.         return $this->assocUserJobLinkedins;
  390.     }
  391.     public function addAssocUserJobLinkedin(AssocUserJobLinkedin $assocUserJobLinkedin): self
  392.     {
  393.         if (!$this->assocUserJobLinkedins->contains($assocUserJobLinkedin)) {
  394.             $this->assocUserJobLinkedins[] = $assocUserJobLinkedin;
  395.             $assocUserJobLinkedin->setJob($this);
  396.         }
  397.         return $this;
  398.     }
  399.     public function removeAssocUserJobLinkedin(AssocUserJobLinkedin $assocUserJobLinkedin): self
  400.     {
  401.         if ($this->assocUserJobLinkedins->removeElement($assocUserJobLinkedin)) {
  402.             // set the owning side to null (unless already changed)
  403.             if ($assocUserJobLinkedin->getJob() === $this) {
  404.                 $assocUserJobLinkedin->setJob(null);
  405.             }
  406.         }
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return Collection<int, self>
  411.      */
  412.     public function getAffinityJobs(): Collection
  413.     {
  414.         return $this->affinityJobs;
  415.     }
  416.     public function addAffinityJob(self $affinityJob): self
  417.     {
  418.         if (!$this->affinityJobs->contains($affinityJob)) {
  419.             $this->affinityJobs[] = $affinityJob;
  420.         }
  421.         return $this;
  422.     }
  423.     public function removeAffinityJob(self $affinityJob): self
  424.     {
  425.         $this->affinityJobs->removeElement($affinityJob);
  426.         return $this;
  427.     }
  428.     /**
  429.      * @return Collection<int, self>
  430.      */
  431.     public function getAffinityParents(): Collection
  432.     {
  433.         return $this->affinityParents;
  434.     }
  435.     public function addAffinityParent(self $affinityParent): self
  436.     {
  437.         if (!$this->affinityParents->contains($affinityParent)) {
  438.             $this->affinityParents[] = $affinityParent;
  439.             $affinityParent->addAffinityJob($this);
  440.         }
  441.         return $this;
  442.     }
  443.     public function removeAffinityParent(self $affinityParent): self
  444.     {
  445.         if ($this->affinityParents->removeElement($affinityParent)) {
  446.             $affinityParent->removeAffinityJob($this);
  447.         }
  448.         return $this;
  449.     }
  450.     /**
  451.      * @return Collection<int, JobAssignment>
  452.      */
  453.     public function getJobAssignments(): Collection
  454.     {
  455.         return $this->jobAssignments;
  456.     }
  457.     public function addJobAssignment(JobAssignment $jobAssignment): self
  458.     {
  459.         if (!$this->jobAssignments->contains($jobAssignment)) {
  460.             $this->jobAssignments[] = $jobAssignment;
  461.         }
  462.         return $this;
  463.     }
  464.     public function removeJobAssignment(JobAssignment $jobAssignment): self
  465.     {
  466.         $this->jobAssignments->removeElement($jobAssignment);
  467.         return $this;
  468.     }
  469.     /**
  470.      * @return Collection<int, Formation>
  471.      */
  472.     public function getFormations(): Collection
  473.     {
  474.         return $this->formations;
  475.     }
  476.     public function addFormation(Formation $formation): self
  477.     {
  478.         if (!$this->formations->contains($formation)) {
  479.             $this->formations[] = $formation;
  480.         }
  481.         return $this;
  482.     }
  483.     public function removeFormation(Formation $formation): self
  484.     {
  485.         $this->formations->removeElement($formation);
  486.         return $this;
  487.     }
  488.     /**
  489.      * @return Collection<int, User>
  490.      */
  491.     public function getStudentsPropertyOfCv(): Collection
  492.     {
  493.         return $this->studentsPropertyOfCv;
  494.     }
  495.     public function addStudentsPropertyOfCv(User $studentsPropertyOfCv): self
  496.     {
  497.         if (!$this->studentsPropertyOfCv->contains($studentsPropertyOfCv)) {
  498.             $this->studentsPropertyOfCv[] = $studentsPropertyOfCv;
  499.             $studentsPropertyOfCv->addJobsFoundedCv($this);
  500.         }
  501.         return $this;
  502.     }
  503.     public function removeStudentsPropertyOfCv(User $studentsPropertyOfCv): self
  504.     {
  505.         if ($this->studentsPropertyOfCv->removeElement($studentsPropertyOfCv)) {
  506.             $studentsPropertyOfCv->removeJobsFoundedCv($this);
  507.         }
  508.         return $this;
  509.     }
  510.     
  511.     public function getStatut(): ?string
  512.     {
  513.         return $this->statut;
  514.     }
  515.     public function setStatut(string $statut): self
  516.     {
  517.         $this->statut $statut;
  518.         return $this;
  519.     }
  520.     public function getContract(): ?JobContract
  521.     {
  522.         return $this->contract;
  523.     }
  524.     public function setContract(?JobContract $contract): self
  525.     {
  526.         $this->contract $contract;
  527.         return $this;
  528.     }
  529.     public function getLocalization(): ?string
  530.     {
  531.         return $this->localization;
  532.     }
  533.     public function setLocalization(?string $localization): self
  534.     {
  535.         $this->localization $localization;
  536.         return $this;
  537.     }
  538.     public function getCreatedby(): ?User
  539.     {
  540.         return $this->createdby;
  541.     }
  542.     public function setCreatedby(?User $createdby): self
  543.     {
  544.         $this->createdby $createdby;
  545.         return $this;
  546.     }
  547.     /**
  548.      * @return Collection<int, UserJobAlgo>
  549.      */
  550.     public function getUserJobAlgos(): Collection
  551.     {
  552.         return $this->userJobAlgos;
  553.     }
  554.     public function addUserJobAlgo(UserJobAlgo $userJobAlgo): self
  555.     {
  556.         if (!$this->userJobAlgos->contains($userJobAlgo)) {
  557.             $this->userJobAlgos[] = $userJobAlgo;
  558.             $userJobAlgo->setJob($this);
  559.         }
  560.         return $this;
  561.     }
  562.     public function removeUserJobAlgo(UserJobAlgo $userJobAlgo): self
  563.     {
  564.         if ($this->userJobAlgos->removeElement($userJobAlgo)) {
  565.             // set the owning side to null (unless already changed)
  566.             if ($userJobAlgo->getJob() === $this) {
  567.                 $userJobAlgo->setJob(null);
  568.             }
  569.         }
  570.         return $this;
  571.     }
  572.     /**
  573.      * @return Collection<int, AssocUserJobMyJobGlasses>
  574.      */
  575.     public function getAssocUserJobMyJobGlasses(): Collection
  576.     {
  577.         return $this->assocUserJobMyJobGlasses;
  578.     }
  579.     public function addAssocUserJobMyJobGlass(AssocUserJobMyJobGlasses $assocUserJobMyJobGlass): self
  580.     {
  581.         if (!$this->assocUserJobMyJobGlasses->contains($assocUserJobMyJobGlass)) {
  582.             $this->assocUserJobMyJobGlasses[] = $assocUserJobMyJobGlass;
  583.             $assocUserJobMyJobGlass->setJob($this);
  584.         }
  585.         return $this;
  586.     }
  587.     public function removeAssocUserJobMyJobGlass(AssocUserJobMyJobGlasses $assocUserJobMyJobGlass): self
  588.     {
  589.         if ($this->assocUserJobMyJobGlasses->removeElement($assocUserJobMyJobGlass)) {
  590.             // set the owning side to null (unless already changed)
  591.             if ($assocUserJobMyJobGlass->getJob() === $this) {
  592.                 $assocUserJobMyJobGlass->setJob(null);
  593.             }
  594.         }
  595.         return $this;
  596.     }
  597.     /**
  598.      * @return Collection<int, User>
  599.      */
  600.     public function getStudentsWhoValidateJob(): Collection
  601.     {
  602.         return $this->studentsWhoValidateJob;
  603.     }
  604.     public function addStudentsWhoValidateJob(User $studentsWhoValidateJob): self
  605.     {
  606.         if (!$this->studentsWhoValidateJob->contains($studentsWhoValidateJob)) {
  607.             $this->studentsWhoValidateJob[] = $studentsWhoValidateJob;
  608.             $studentsWhoValidateJob->addValidateJob($this);
  609.         }
  610.         return $this;
  611.     }
  612.     public function removeStudentsWhoValidateJob(User $studentsWhoValidateJob): self
  613.     {
  614.         if ($this->studentsWhoValidateJob->removeElement($studentsWhoValidateJob)) {
  615.             $studentsWhoValidateJob->removeValidateJob($this);
  616.         }
  617.         return $this;
  618.     }
  619. }