<?php
namespace App\Entity;
use App\Repository\QuestionariRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: QuestionariRepository::class)]
class Questionari
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $titolo;
#[ORM\Column(type: 'text', nullable: true)]
private $descrizione;
#[ORM\Column(type: 'datetime_immutable')]
private $created_at;
#[ORM\ManyToOne(targetEntity: Users::class, inversedBy: 'questionaris')]
#[ORM\JoinColumn(nullable: false)]
private $user;
#[ORM\OneToMany(mappedBy: 'questionario', targetEntity: Domande::class, orphanRemoval: true)]
private $domandes;
#[ORM\ManyToOne(targetEntity: UsersAmbienti::class, inversedBy: 'questionaris')]
private $ambiente;
#[ORM\Column(type: 'integer', nullable: true)]
private $corso_id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $corso_title;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'questionaris')]
private $questionario;
#[ORM\OneToMany(mappedBy: 'questionario', targetEntity: self::class)]
private $questionaris;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $token;
#[ORM\OneToMany(mappedBy: 'questionario', targetEntity: QuestionariIniziati::class, orphanRemoval: true)]
private $questionariIniziatis;
#[ORM\OneToMany(mappedBy: 'questionario', targetEntity: Risposte::class)]
private $rispostes;
public function __construct()
{
$this->domandes = new ArrayCollection();
$this->questionaris = new ArrayCollection();
$this->questionariIniziatis = new ArrayCollection();
$this->rispostes = new ArrayCollection();
}
public function __toString()
{
return $this->id;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitolo(): ?string
{
return $this->titolo;
}
public function setTitolo(string $titolo): self
{
$this->titolo = $titolo;
return $this;
}
public function getDescrizione(): ?string
{
return $this->descrizione;
}
public function setDescrizione(?string $descrizione): self
{
$this->descrizione = $descrizione;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUser(): ?Users
{
return $this->user;
}
public function setUser(?Users $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection<int, Domande>
*/
public function getDomandes(): Collection
{
return $this->domandes;
}
public function addDomande(Domande $domande): self
{
if (!$this->domandes->contains($domande)) {
$this->domandes[] = $domande;
$domande->setQuestionario($this);
}
return $this;
}
public function removeDomande(Domande $domande): self
{
if ($this->domandes->removeElement($domande)) {
// set the owning side to null (unless already changed)
if ($domande->getQuestionario() === $this) {
$domande->setQuestionario(null);
}
}
return $this;
}
public function getAmbiente(): ?UsersAmbienti
{
return $this->ambiente;
}
public function setAmbiente(?UsersAmbienti $ambiente): self
{
$this->ambiente = $ambiente;
return $this;
}
public function getCorsoId(): ?int
{
return $this->corso_id;
}
public function setCorsoId(?int $corso_id): self
{
$this->corso_id = $corso_id;
return $this;
}
public function getCorsoTitle(): ?string
{
return $this->corso_title;
}
public function setCorsoTitle(?string $corso_title): self
{
$this->corso_title = $corso_title;
return $this;
}
public function getQuestionario(): ?self
{
return $this->questionario;
}
public function setQuestionario(?self $questionario): self
{
$this->questionario = $questionario;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getQuestionaris(): Collection
{
return $this->questionaris;
}
public function addQuestionari(self $questionari): self
{
if (!$this->questionaris->contains($questionari)) {
$this->questionaris[] = $questionari;
$questionari->setQuestionario($this);
}
return $this;
}
public function removeQuestionari(self $questionari): self
{
if ($this->questionaris->removeElement($questionari)) {
// set the owning side to null (unless already changed)
if ($questionari->getQuestionario() === $this) {
$questionari->setQuestionario(null);
}
}
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
/**
* @return Collection<int, QuestionariIniziati>
*/
public function getQuestionariIniziatis(): Collection
{
return $this->questionariIniziatis;
}
public function addQuestionariIniziati(QuestionariIniziati $questionariIniziati): self
{
if (!$this->questionariIniziatis->contains($questionariIniziati)) {
$this->questionariIniziatis[] = $questionariIniziati;
$questionariIniziati->setQuestionario($this);
}
return $this;
}
public function removeQuestionariIniziati(QuestionariIniziati $questionariIniziati): self
{
if ($this->questionariIniziatis->removeElement($questionariIniziati)) {
// set the owning side to null (unless already changed)
if ($questionariIniziati->getQuestionario() === $this) {
$questionariIniziati->setQuestionario(null);
}
}
return $this;
}
/**
* @return Collection<int, Risposte>
*/
public function getRispostes(): Collection
{
return $this->rispostes;
}
public function addRisposte(Risposte $risposte): self
{
if (!$this->rispostes->contains($risposte)) {
$this->rispostes[] = $risposte;
$risposte->setQuestionario($this);
}
return $this;
}
public function removeRisposte(Risposte $risposte): self
{
if ($this->rispostes->removeElement($risposte)) {
// set the owning side to null (unless already changed)
if ($risposte->getQuestionario() === $this) {
$risposte->setQuestionario(null);
}
}
return $this;
}
}