<?php
namespace App\Entity\Quiz\RiasecBigFive;
use App\Entity\EntityIdentifier;
use App\Entity\Profil\BigFiveProfile;
use App\Entity\Profil\Profil;
use App\Entity\UserRBQuizResponse;
use App\Repository\Quiz\RiasecBigFive\RBQuizRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
/**
* @ORM\Entity(repositoryClass=RBQuizRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class RBQuiz
{
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 $quizType;
/**
* @ORM\ManyToOne(targetEntity=Profil::class, inversedBy="rBQuizzes")
*/
private $riasecProfile;
/**
* @ORM\ManyToOne(targetEntity=BigFiveProfile::class, inversedBy="rBQuizzes")
*/
private $bigFiveProfile;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $normalWeighting;
/**
* @ORM\OneToMany(targetEntity=RBQuizTranslation::class, mappedBy="translatable", cascade={"persist"})
*/
protected $newTranslations;
/**
* @ORM\OneToMany(targetEntity=UserRBQuizResponse::class, mappedBy="rbQuiz")
*/
private $userRBQuizResponses;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $active;
public function __construct()
{
$this->userRBQuizResponses = new ArrayCollection();
}
/**
* @ORM\PostLoad()
*/
public function init() {
$this->mergeNewTranslations();
$this->currentLocale = \Locale::getDefault();
}
public function __call($name, $arguments) {
$reflect = new \ReflectionClass(RBQuizTranslation::class);
$privateProperties = $reflect->getProperties(\ReflectionProperty::IS_PRIVATE);
foreach ($privateProperties as $property) {
if($property->getName() == $name) {
return $this->translate()->{"get" . ucfirst($name)}();
}
}
return "";
}
public function getId(): ?int
{
return $this->id;
}
public function getQuizType(): ?string
{
return $this->quizType;
}
public function setQuizType(?string $quizType): self
{
$this->quizType = $quizType;
return $this;
}
public function getRiasecProfile(): ?Profil
{
return $this->riasecProfile;
}
public function setRiasecProfile(?Profil $riasecProfile): self
{
$this->riasecProfile = $riasecProfile;
return $this;
}
public function getBigFiveProfile(): ?BigFiveProfile
{
return $this->bigFiveProfile;
}
public function setBigFiveProfile(?BigFiveProfile $bigFiveProfile): self
{
$this->bigFiveProfile = $bigFiveProfile;
return $this;
}
public function isNormalWeighting(): ?bool
{
return $this->normalWeighting;
}
public function setNormalWeighting(?bool $normalWeighting): self
{
$this->normalWeighting = $normalWeighting;
return $this;
}
/**
* @return Collection<int, UserRBQuizResponse>
*/
public function getUserRBQuizResponses(): Collection
{
return $this->userRBQuizResponses;
}
public function addUserRBQuizResponse(UserRBQuizResponse $userRBQuizResponse): self
{
if (!$this->userRBQuizResponses->contains($userRBQuizResponse)) {
$this->userRBQuizResponses[] = $userRBQuizResponse;
$userRBQuizResponse->setRbQuiz($this);
}
return $this;
}
public function removeUserRBQuizResponse(UserRBQuizResponse $userRBQuizResponse): self
{
if ($this->userRBQuizResponses->removeElement($userRBQuizResponse)) {
// set the owning side to null (unless already changed)
if ($userRBQuizResponse->getRbQuiz() === $this) {
$userRBQuizResponse->setRbQuiz(null);
}
}
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(?bool $active): self
{
$this->active = $active;
return $this;
}
}