<?php
namespace App\Entity\JobConfiguration;
use App\Entity\AssocUserJobMyJobGlasses;
use App\Entity\Configuration\JobContract;
use App\Entity\DateTrait;
use App\Entity\User;
use App\Entity\Profil\Profil;
use App\Entity\LinkedinProfile;
use App\Entity\EntityIdentifier;
use App\Entity\UserJobAlgo;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\AssocUserJobLinkedin;
use App\Entity\RecruterDreaminJob\Society;
use Doctrine\Common\Collections\Collection;
use App\Entity\RecruterDreaminJob\Interview;
use Doctrine\Common\Collections\ArrayCollection;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Entity\JobConfiguration\Job\JobAssignment;
use App\Repository\JobConfiguration\JobRepository;
use App\Entity\Configuration\School\Formation\Formation;
use App\Entity\JobConfiguration\Job\Favorites\Favorites;
use App\Enum\JobStatutEnum;
/**
* @ORM\Entity(repositoryClass=JobRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class Job
{
use ORMBehaviors\Translatable\Translatable;
use EntityIdentifier;
use DateTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"badge_cv"})
*/
private $id;
/**
* @ORM\OneToMany(targetEntity=JobTranslation::class, mappedBy="translatable", cascade={"persist"})
*/
protected $newTranslations;
/**
* @Groups({"badge_cv"})
*/
protected $translations;
/**
* @ORM\ManyToOne(targetEntity=JobSubCategory::class, inversedBy="jobs")
*/
private $jobSubCategory;
/**
* @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobs")
* @Groups({"badge_cv"})
*/
private $majorProfile;
/**
* @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobMinors")
* @Groups({"badge_cv"})
*/
private $minorProfile;
/**
* @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="jobFairs")
* @Groups({"badge_cv"})
*/
private $fair;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"badge_cv"})
*/
private $picture;
/**
* @ORM\OneToMany(targetEntity=JobUserProfile::class, mappedBy="job")
*/
private $jobUserProfiles;
/**
* @ORM\OneToMany(targetEntity=Favorites::class, mappedBy="job")
*/
private $favorites;
/**
* @ORM\OneToMany(targetEntity=LinkedinProfile::class, mappedBy="job")
*/
private $linkedinProfiles;
/**
* @ORM\OneToMany(targetEntity=JobUserProfile::class, mappedBy="previousJob")
*/
private $previousJobOfUsers;
/**
* @ORM\ManyToMany(targetEntity=Job::class)
*/
private $suggestionJobs;
/**
* @ORM\ManyToMany(targetEntity=User::class, mappedBy="experiencesJob")
*/
private $usersWithThisJobAsExperiences;
/**
* @ORM\OneToMany(targetEntity=AssocUserJobLinkedin::class, mappedBy="job")
*/
private $assocUserJobLinkedins;
/**
* @ORM\ManyToMany(targetEntity=Job::class, inversedBy="affinityParents")
* @ORM\JoinTable(name="job_affinity_job")
*/
private $affinityJobs;
/**
* @ORM\ManyToMany(targetEntity=Job::class, mappedBy="affinityJobs")
*/
private $affinityParents;
/**
* @ORM\ManyToMany(targetEntity=JobAssignment::class, inversedBy="jobs")
*/
private $jobAssignments;
/**
* @ORM\ManyToMany(targetEntity=Formation::class, inversedBy="jobs")
*/
private $formations;
/**
* @ORM\ManyToMany(targetEntity=User::class, mappedBy="jobsFoundedCv")
*/
private $studentsPropertyOfCv;
/**
* @ORM\Column(type="string", length=255 , nullable=true, options={"default" : JobStatutEnum::INPROGRESS})
*/
private $statut ;
/**
* @ORM\ManyToOne(targetEntity=JobContract::class)
*/
private $contract;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $localization;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $createdby;
/**
* @ORM\OneToMany(targetEntity=UserJobAlgo::class, mappedBy="job")
*/
private $userJobAlgos;
/**
* @ORM\OneToMany(targetEntity=AssocUserJobMyJobGlasses::class, mappedBy="job")
*/
private $assocUserJobMyJobGlasses;
/**
* @ORM\ManyToMany(targetEntity=User::class, mappedBy="validateJobs")
*/
private $studentsWhoValidateJob;
public function __construct()
{
$this->jobUserProfiles = new ArrayCollection();
$this->favorites = new ArrayCollection();
$this->linkedinProfiles = new ArrayCollection();
$this->previousJobOfUsers = new ArrayCollection();
$this->suggestionJobs = new ArrayCollection();
$this->usersWithThisJobAsExperiences = new ArrayCollection();
$this->assocUserJobLinkedins = new ArrayCollection();
$this->affinityJobs = new ArrayCollection();
$this->affinityParents = new ArrayCollection();
$this->jobAssignments = new ArrayCollection();
$this->formations = new ArrayCollection();
$this->studentsPropertyOfCv = new ArrayCollection();
$this->interviews = new ArrayCollection();
$this->userJobAlgos = new ArrayCollection();
$this->assocUserJobMyJobGlasses = new ArrayCollection();
$this->studentsWhoValidateJob = new ArrayCollection();
}
/**
* @ORM\PostLoad()
*/
public function init() {
$this->mergeNewTranslations();
$this->currentLocale = \Locale::getDefault();
}
public function getId(): ?int
{
return $this->id;
}
public function getJobSubCategory(): ?JobSubCategory
{
return $this->jobSubCategory;
}
public function setJobSubCategory(?JobSubCategory $jobSubCategory): self
{
$this->jobSubCategory = $jobSubCategory;
return $this;
}
public function __call($name, $arguments) {
$reflect = new \ReflectionClass( JobTranslation::class);
$privateProperties = $reflect->getProperties(\ReflectionProperty::IS_PRIVATE);
foreach ($privateProperties as $property) {
if($property->getName() == $name) {
return $this->translate()->{"get" . ucfirst($name)}();
}
}
return "";
}
public function getMajorProfile(): ?Profil
{
return $this->majorProfile;
}
public function setMajorProfile(?Profil $majorProfile): self
{
$this->majorProfile = $majorProfile;
return $this;
}
public function getMinorProfile(): ?Profil
{
return $this->minorProfile;
}
public function setMinorProfile(?Profil $minorProfile): self
{
$this->minorProfile = $minorProfile;
return $this;
}
public function getFair(): ?Profil
{
return $this->fair;
}
public function setFair(?Profil $fair): self
{
$this->fair = $fair;
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(?string $picture): self
{
$this->picture = $picture;
return $this;
}
/**
* @return Collection<int, JobUserProfile>
*/
public function getJobUserProfiles(): Collection
{
return $this->jobUserProfiles;
}
public function addJobUserProfile(JobUserProfile $jobUserProfile): self
{
if (!$this->jobUserProfiles->contains($jobUserProfile)) {
$this->jobUserProfiles[] = $jobUserProfile;
$jobUserProfile->setJob($this);
}
return $this;
}
public function removeJobUserProfile(JobUserProfile $jobUserProfile): self
{
if ($this->jobUserProfiles->removeElement($jobUserProfile)) {
// set the owning side to null (unless already changed)
if ($jobUserProfile->getJob() === $this) {
$jobUserProfile->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, Favorites>
*/
public function getFavorites(): Collection
{
return $this->favorites;
}
public function addFavorite(Favorites $favorite): self
{
if (!$this->favorites->contains($favorite)) {
$this->favorites[] = $favorite;
$favorite->setJob($this);
}
return $this;
}
public function removeFavorite(Favorites $favorite): self
{
if ($this->favorites->removeElement($favorite)) {
// set the owning side to null (unless already changed)
if ($favorite->getJob() === $this) {
$favorite->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, LinkedinProfile>
*/
public function getLinkedinProfiles(): Collection
{
return $this->linkedinProfiles;
}
public function addLinkedinProfile(LinkedinProfile $linkedinProfile): self
{
if (!$this->linkedinProfiles->contains($linkedinProfile)) {
$this->linkedinProfiles[] = $linkedinProfile;
$linkedinProfile->setJob($this);
}
return $this;
}
public function removeLinkedinProfile(LinkedinProfile $linkedinProfile): self
{
if ($this->linkedinProfiles->removeElement($linkedinProfile)) {
// set the owning side to null (unless already changed)
if ($linkedinProfile->getJob() === $this) {
$linkedinProfile->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, JobUserProfile>
*/
public function getPreviousJobOfUsers(): Collection
{
return $this->previousJobOfUsers;
}
public function addPreviousJobOfUser(JobUserProfile $previousJobOfUser): self
{
if (!$this->previousJobOfUsers->contains($previousJobOfUser)) {
$this->previousJobOfUsers[] = $previousJobOfUser;
$previousJobOfUser->setPreviousJob($this);
}
return $this;
}
public function removePreviousJobOfUser(JobUserProfile $previousJobOfUser): self
{
if ($this->previousJobOfUsers->removeElement($previousJobOfUser)) {
// set the owning side to null (unless already changed)
if ($previousJobOfUser->getPreviousJob() === $this) {
$previousJobOfUser->setPreviousJob(null);
}
}
return $this;
}
/**
* @return Collection<int, self>
*/
public function getSuggestionJobs(): Collection
{
return $this->suggestionJobs;
}
public function addSuggestionJob(self $suggestionJob): self
{
if (!$this->suggestionJobs->contains($suggestionJob)) {
$this->suggestionJobs[] = $suggestionJob;
}
return $this;
}
public function removeSuggestionJob(self $suggestionJob): self
{
$this->suggestionJobs->removeElement($suggestionJob);
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsersWithThisJobAsExperiences(): Collection
{
return $this->usersWithThisJobAsExperiences;
}
public function addUsersWithThisJobAsExperience(User $usersWithThisJobAsExperience): self
{
if (!$this->usersWithThisJobAsExperiences->contains($usersWithThisJobAsExperience)) {
$this->usersWithThisJobAsExperiences[] = $usersWithThisJobAsExperience;
$usersWithThisJobAsExperience->addExperiencesJob($this);
}
return $this;
}
public function removeUsersWithThisJobAsExperience(User $usersWithThisJobAsExperience): self
{
if ($this->usersWithThisJobAsExperiences->removeElement($usersWithThisJobAsExperience)) {
$usersWithThisJobAsExperience->removeExperiencesJob($this);
}
return $this;
}
/**
* @return Collection<int, AssocUserJobLinkedin>
*/
public function getAssocUserJobLinkedins(): Collection
{
return $this->assocUserJobLinkedins;
}
public function addAssocUserJobLinkedin(AssocUserJobLinkedin $assocUserJobLinkedin): self
{
if (!$this->assocUserJobLinkedins->contains($assocUserJobLinkedin)) {
$this->assocUserJobLinkedins[] = $assocUserJobLinkedin;
$assocUserJobLinkedin->setJob($this);
}
return $this;
}
public function removeAssocUserJobLinkedin(AssocUserJobLinkedin $assocUserJobLinkedin): self
{
if ($this->assocUserJobLinkedins->removeElement($assocUserJobLinkedin)) {
// set the owning side to null (unless already changed)
if ($assocUserJobLinkedin->getJob() === $this) {
$assocUserJobLinkedin->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, self>
*/
public function getAffinityJobs(): Collection
{
return $this->affinityJobs;
}
public function addAffinityJob(self $affinityJob): self
{
if (!$this->affinityJobs->contains($affinityJob)) {
$this->affinityJobs[] = $affinityJob;
}
return $this;
}
public function removeAffinityJob(self $affinityJob): self
{
$this->affinityJobs->removeElement($affinityJob);
return $this;
}
/**
* @return Collection<int, self>
*/
public function getAffinityParents(): Collection
{
return $this->affinityParents;
}
public function addAffinityParent(self $affinityParent): self
{
if (!$this->affinityParents->contains($affinityParent)) {
$this->affinityParents[] = $affinityParent;
$affinityParent->addAffinityJob($this);
}
return $this;
}
public function removeAffinityParent(self $affinityParent): self
{
if ($this->affinityParents->removeElement($affinityParent)) {
$affinityParent->removeAffinityJob($this);
}
return $this;
}
/**
* @return Collection<int, JobAssignment>
*/
public function getJobAssignments(): Collection
{
return $this->jobAssignments;
}
public function addJobAssignment(JobAssignment $jobAssignment): self
{
if (!$this->jobAssignments->contains($jobAssignment)) {
$this->jobAssignments[] = $jobAssignment;
}
return $this;
}
public function removeJobAssignment(JobAssignment $jobAssignment): self
{
$this->jobAssignments->removeElement($jobAssignment);
return $this;
}
/**
* @return Collection<int, Formation>
*/
public function getFormations(): Collection
{
return $this->formations;
}
public function addFormation(Formation $formation): self
{
if (!$this->formations->contains($formation)) {
$this->formations[] = $formation;
}
return $this;
}
public function removeFormation(Formation $formation): self
{
$this->formations->removeElement($formation);
return $this;
}
/**
* @return Collection<int, User>
*/
public function getStudentsPropertyOfCv(): Collection
{
return $this->studentsPropertyOfCv;
}
public function addStudentsPropertyOfCv(User $studentsPropertyOfCv): self
{
if (!$this->studentsPropertyOfCv->contains($studentsPropertyOfCv)) {
$this->studentsPropertyOfCv[] = $studentsPropertyOfCv;
$studentsPropertyOfCv->addJobsFoundedCv($this);
}
return $this;
}
public function removeStudentsPropertyOfCv(User $studentsPropertyOfCv): self
{
if ($this->studentsPropertyOfCv->removeElement($studentsPropertyOfCv)) {
$studentsPropertyOfCv->removeJobsFoundedCv($this);
}
return $this;
}
public function getStatut(): ?string
{
return $this->statut;
}
public function setStatut(string $statut): self
{
$this->statut = $statut;
return $this;
}
public function getContract(): ?JobContract
{
return $this->contract;
}
public function setContract(?JobContract $contract): self
{
$this->contract = $contract;
return $this;
}
public function getLocalization(): ?string
{
return $this->localization;
}
public function setLocalization(?string $localization): self
{
$this->localization = $localization;
return $this;
}
public function getCreatedby(): ?User
{
return $this->createdby;
}
public function setCreatedby(?User $createdby): self
{
$this->createdby = $createdby;
return $this;
}
/**
* @return Collection<int, UserJobAlgo>
*/
public function getUserJobAlgos(): Collection
{
return $this->userJobAlgos;
}
public function addUserJobAlgo(UserJobAlgo $userJobAlgo): self
{
if (!$this->userJobAlgos->contains($userJobAlgo)) {
$this->userJobAlgos[] = $userJobAlgo;
$userJobAlgo->setJob($this);
}
return $this;
}
public function removeUserJobAlgo(UserJobAlgo $userJobAlgo): self
{
if ($this->userJobAlgos->removeElement($userJobAlgo)) {
// set the owning side to null (unless already changed)
if ($userJobAlgo->getJob() === $this) {
$userJobAlgo->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, AssocUserJobMyJobGlasses>
*/
public function getAssocUserJobMyJobGlasses(): Collection
{
return $this->assocUserJobMyJobGlasses;
}
public function addAssocUserJobMyJobGlass(AssocUserJobMyJobGlasses $assocUserJobMyJobGlass): self
{
if (!$this->assocUserJobMyJobGlasses->contains($assocUserJobMyJobGlass)) {
$this->assocUserJobMyJobGlasses[] = $assocUserJobMyJobGlass;
$assocUserJobMyJobGlass->setJob($this);
}
return $this;
}
public function removeAssocUserJobMyJobGlass(AssocUserJobMyJobGlasses $assocUserJobMyJobGlass): self
{
if ($this->assocUserJobMyJobGlasses->removeElement($assocUserJobMyJobGlass)) {
// set the owning side to null (unless already changed)
if ($assocUserJobMyJobGlass->getJob() === $this) {
$assocUserJobMyJobGlass->setJob(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getStudentsWhoValidateJob(): Collection
{
return $this->studentsWhoValidateJob;
}
public function addStudentsWhoValidateJob(User $studentsWhoValidateJob): self
{
if (!$this->studentsWhoValidateJob->contains($studentsWhoValidateJob)) {
$this->studentsWhoValidateJob[] = $studentsWhoValidateJob;
$studentsWhoValidateJob->addValidateJob($this);
}
return $this;
}
public function removeStudentsWhoValidateJob(User $studentsWhoValidateJob): self
{
if ($this->studentsWhoValidateJob->removeElement($studentsWhoValidateJob)) {
$studentsWhoValidateJob->removeValidateJob($this);
}
return $this;
}
}