<?phpnamespace App\Entity\Gos\Uniqskills;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Table() * @ORM\Entity(repositoryClass="App\Repository\Gos\Uniqskills\AnswerRepository") * @ORM\HasLifecycleCallbacks */class Answer{ /** * @var integer * * @ORM\Column(type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\Column(type="text") */ private $name; /** * @Gedmo\Slug(fields={"name"}) * @ORM\Column(type="string", length=191, unique=true) */ private $slug; /** * @var bool * @ORM\Column(type="boolean") */ private $isTrue; /** * @var \DateTime * * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @var \DateTime * * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; /** * @ORM\ManyToOne(targetEntity="Question", inversedBy="answer") * @ORM\JoinColumn(name="question_id", referencedColumnName="id", onDelete="CASCADE") */ private $question; /** * @ORM\OneToMany(targetEntity="UserAnswer", mappedBy="answer") */ private $userAnswer; /** @ORM\PrePersist() */ public function prePersist() { $this->createdAt = new \DateTime(); } /** @ORM\PreUpdate() */ public function preUpdate() { $this->updatedAt = new \DateTime(); } public function __toString() { return (string) $this->name; } /** * Constructor */ public function __construct() { $this->clientAnswer = new \Doctrine\Common\Collections\ArrayCollection(); $this->userAnswer = new ArrayCollection(); } public function __clone() { $this->id = null; $this->updatedAt = null; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } public function getIsTrue(): ?bool { return $this->isTrue; } public function setIsTrue(bool $isTrue): self { $this->isTrue = $isTrue; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getQuestion(): ?Question { return $this->question; } public function setQuestion(?Question $question): self { $this->question = $question; return $this; } /** * @return Collection|UserAnswer[] */ public function getUserAnswer(): Collection { return $this->userAnswer; } public function addUserAnswer(UserAnswer $userAnswer): self { if (!$this->userAnswer->contains($userAnswer)) { $this->userAnswer[] = $userAnswer; $userAnswer->setAnswer($this); } return $this; } public function removeUserAnswer(UserAnswer $userAnswer): self { if ($this->userAnswer->contains($userAnswer)) { $this->userAnswer->removeElement($userAnswer); // set the owning side to null (unless already changed) if ($userAnswer->getAnswer() === $this) { $userAnswer->setAnswer(null); } } return $this; } /* ****************************** GETTERS & SETTERS ****************************** */}