<?php
namespace App\Entity\Profil;
use App\Entity\EntityIdentifier;
use App\Entity\JobConfiguration\Job;
use App\Entity\Quiz\RiasecBigFive\RBQuiz;
use App\Entity\Quiz\RiasecQuizResponse;
use App\Entity\UserRiasecProfile;
use App\Repository\Profil\ProfilRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ProfilRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class Profil
{
use ORMBehaviors\Translatable\Translatable;
use EntityIdentifier;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $color;
/**
* @ORM\OneToMany(targetEntity=ProfilTranslation::class, mappedBy="translatable", cascade={"persist"})
*/
protected $newTranslations;
/**
* @ORM\OneToMany(targetEntity=RiasecQuizResponse::class, mappedBy="profile")
*/
private $riasecQuizResponses;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"badge_cv"})
*/
private $icon;
/**
* @ORM\OneToMany(targetEntity=Job::class, mappedBy="majorProfile")
*/
private $jobs;
/**
* @ORM\OneToMany(targetEntity=Job::class, mappedBy="minorProfile")
*/
private $jobMinors;
/**
* @ORM\OneToMany(targetEntity=Job::class, mappedBy="fair")
*/
private $jobFairs;
/**
* @ORM\OneToMany(targetEntity=TwiceProfile::class, mappedBy="profileA")
*/
private $twiceProfilesA;
/**
* @ORM\OneToMany(targetEntity=TwiceProfile::class, mappedBy="profileB")
*/
private $twiceProfilesB;
/**
* @ORM\OneToMany(targetEntity=ProfilPositiveDescription::class, mappedBy="profil")
*/
private $profilPositiveDescriptions;
/**
* @ORM\OneToMany(targetEntity=ProfilNegativeDescription::class, mappedBy="profil")
*/
private $profilNegativeDescriptions;
/**
* @ORM\OneToMany(targetEntity=RBQuiz::class, mappedBy="riasecProfile")
*/
private $rBQuizzes;
/**
* @ORM\OneToMany(targetEntity=UserRiasecProfile::class, mappedBy="riasecProfile")
*/
private $userRiasecProfiles;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $mainletter;
public function __construct()
{
$this->riasecQuizResponses = new ArrayCollection();
$this->jobs = new ArrayCollection();
$this->jobMinors = new ArrayCollection();
$this->jobFairs = new ArrayCollection();
$this->twiceProfilesA = new ArrayCollection();
$this->twiceProfilesB = new ArrayCollection();
$this->profilPositiveDescriptions = new ArrayCollection();
$this->profilNegativeDescriptions = new ArrayCollection();
$this->rBQuizzes = new ArrayCollection();
$this->userRiasecProfiles = new ArrayCollection();
}
/**
* @ORM\PostLoad()
*/
public function init() {
$this->mergeNewTranslations();
$this->currentLocale = \Locale::getDefault();
}
public function getId(): ?int
{
return $this->id;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function __call($name, $arguments) {
$reflect = new \ReflectionClass(ProfilTranslation::class);
$privateProperties = $reflect->getProperties(\ReflectionProperty::IS_PRIVATE);
foreach ($privateProperties as $property) {
if($property->getName() == $name) {
return $this->translate()->{"get" . ucfirst($name)}();
}
}
return "";
}
/**
* @return Collection<int, RiasecQuizResponse>
*/
public function getRiasecQuizResponses(): Collection
{
return $this->riasecQuizResponses;
}
public function addRiasecQuizResponse(RiasecQuizResponse $riasecQuizResponse): self
{
if (!$this->riasecQuizResponses->contains($riasecQuizResponse)) {
$this->riasecQuizResponses[] = $riasecQuizResponse;
$riasecQuizResponse->setProfile($this);
}
return $this;
}
public function removeRiasecQuizResponse(RiasecQuizResponse $riasecQuizResponse): self
{
if ($this->riasecQuizResponses->removeElement($riasecQuizResponse)) {
// set the owning side to null (unless already changed)
if ($riasecQuizResponse->getProfile() === $this) {
$riasecQuizResponse->setProfile(null);
}
}
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Job>
*/
public function getJobs(): Collection
{
return $this->jobs;
}
public function addJob(Job $job): self
{
if (!$this->jobs->contains($job)) {
$this->jobs[] = $job;
$job->setMajorProfile($this);
}
return $this;
}
public function removeJob(Job $job): self
{
if ($this->jobs->removeElement($job)) {
// set the owning side to null (unless already changed)
if ($job->getMajorProfile() === $this) {
$job->setMajorProfile(null);
}
}
return $this;
}
/**
* @return Collection<int, Job>
*/
public function getJobMinors(): Collection
{
return $this->jobMinors;
}
public function addJobMinor(Job $jobMinor): self
{
if (!$this->jobMinors->contains($jobMinor)) {
$this->jobMinors[] = $jobMinor;
$jobMinor->setMinorProfile($this);
}
return $this;
}
public function removeJobMinor(Job $jobMinor): self
{
if ($this->jobMinors->removeElement($jobMinor)) {
// set the owning side to null (unless already changed)
if ($jobMinor->getMinorProfile() === $this) {
$jobMinor->setMinorProfile(null);
}
}
return $this;
}
/**
* @return Collection<int, Job>
*/
public function getJobFairs(): Collection
{
return $this->jobFairs;
}
public function addJobFair(Job $jobFair): self
{
if (!$this->jobFairs->contains($jobFair)) {
$this->jobFairs[] = $jobFair;
$jobFair->setFair($this);
}
return $this;
}
public function removeJobFair(Job $jobFair): self
{
if ($this->jobFairs->removeElement($jobFair)) {
// set the owning side to null (unless already changed)
if ($jobFair->getFair() === $this) {
$jobFair->setFair(null);
}
}
return $this;
}
/**
* @return Collection<int, TwiceProfile>
*/
public function getTwiceProfilesA(): Collection
{
return $this->twiceProfilesA;
}
public function addTwiceProfilesA(TwiceProfile $twiceProfilesA): self
{
if (!$this->twiceProfilesA->contains($twiceProfilesA)) {
$this->twiceProfilesA[] = $twiceProfilesA;
$twiceProfilesA->setProfileA($this);
}
return $this;
}
public function removeTwiceProfilesA(TwiceProfile $twiceProfilesA): self
{
if ($this->twiceProfilesA->removeElement($twiceProfilesA)) {
// set the owning side to null (unless already changed)
if ($twiceProfilesA->getProfileA() === $this) {
$twiceProfilesA->setProfileA(null);
}
}
return $this;
}
/**
* @return Collection<int, TwiceProfile>
*/
public function getTwiceProfilesB(): Collection
{
return $this->twiceProfilesB;
}
public function addTwiceProfileB(TwiceProfile $twiceProfileB): self
{
if (!$this->twiceProfilesB->contains($twiceProfileB)) {
$this->twiceProfilesB[] = $twiceProfileB;
$twiceProfileB->setProfileB($this);
}
return $this;
}
public function removeTwiceProfileB(TwiceProfile $twiceProfileB): self
{
if ($this->twiceProfilesB->removeElement($twiceProfileB)) {
// set the owning side to null (unless already changed)
if ($twiceProfileB->getProfileB() === $this) {
$twiceProfileB->setProfileB(null);
}
}
return $this;
}
/**
* @return Collection<int, ProfilPositiveDescription>
*/
public function getProfilPositiveDescriptions(): Collection
{
return $this->profilPositiveDescriptions;
}
public function addProfilPositiveDescription(ProfilPositiveDescription $profilPositiveDescription): self
{
if (!$this->profilPositiveDescriptions->contains($profilPositiveDescription)) {
$this->profilPositiveDescriptions[] = $profilPositiveDescription;
$profilPositiveDescription->setProfil($this);
}
return $this;
}
public function removeProfilPositiveDescription(ProfilPositiveDescription $profilPositiveDescription): self
{
if ($this->profilPositiveDescriptions->removeElement($profilPositiveDescription)) {
// set the owning side to null (unless already changed)
if ($profilPositiveDescription->getProfil() === $this) {
$profilPositiveDescription->setProfil(null);
}
}
return $this;
}
/**
* @return Collection<int, ProfilNegativeDescription>
*/
public function getProfilNegativeDescriptions(): Collection
{
return $this->profilNegativeDescriptions;
}
public function addProfilNegativeDescription(ProfilNegativeDescription $profilNegativeDescription): self
{
if (!$this->profilNegativeDescriptions->contains($profilNegativeDescription)) {
$this->profilNegativeDescriptions[] = $profilNegativeDescription;
$profilNegativeDescription->setProfil($this);
}
return $this;
}
public function removeProfilNegativeDescription(ProfilNegativeDescription $profilNegativeDescription): self
{
if ($this->profilNegativeDescriptions->removeElement($profilNegativeDescription)) {
// set the owning side to null (unless already changed)
if ($profilNegativeDescription->getProfil() === $this) {
$profilNegativeDescription->setProfil(null);
}
}
return $this;
}
/**
* @return Collection<int, RBQuiz>
*/
public function getRBQuizzes(): Collection
{
return $this->rBQuizzes;
}
public function addRBQuiz(RBQuiz $rBQuiz): self
{
if (!$this->rBQuizzes->contains($rBQuiz)) {
$this->rBQuizzes[] = $rBQuiz;
$rBQuiz->setRiasecProfile($this);
}
return $this;
}
public function removeRBQuiz(RBQuiz $rBQuiz): self
{
if ($this->rBQuizzes->removeElement($rBQuiz)) {
// set the owning side to null (unless already changed)
if ($rBQuiz->getRiasecProfile() === $this) {
$rBQuiz->setRiasecProfile(null);
}
}
return $this;
}
/**
* @return Collection<int, UserRiasecProfile>
*/
public function getUserRiasecProfiles(): Collection
{
return $this->userRiasecProfiles;
}
public function addUserRiasecProfile(UserRiasecProfile $userRiasecProfile): self
{
if (!$this->userRiasecProfiles->contains($userRiasecProfile)) {
$this->userRiasecProfiles[] = $userRiasecProfile;
$userRiasecProfile->setRiasecProfile($this);
}
return $this;
}
public function removeUserRiasecProfile(UserRiasecProfile $userRiasecProfile): self
{
if ($this->userRiasecProfiles->removeElement($userRiasecProfile)) {
// set the owning side to null (unless already changed)
if ($userRiasecProfile->getRiasecProfile() === $this) {
$userRiasecProfile->setRiasecProfile(null);
}
}
return $this;
}
public function getMainletter(): ?string
{
return $this->mainletter;
}
public function setMainletter(?string $mainletter): self
{
$this->mainletter = $mainletter;
return $this;
}
}