src/Entity/Poll.php line 14
<?phpdeclare(strict_types=1);namespace App\Entity;use App\Repository\PollRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PollRepository::class)]#[ORM\Table(name: 'polls')]#[ORM\HasLifecycleCallbacks]class Poll{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private ?int $id = null;#[ORM\Column(type: 'string', length: 255)]private ?string $title = null;#[ORM\Column(type: 'datetime')]private ?\DateTimeInterface $createdAt = null;#[ORM\Column(type: 'datetime')]private ?\DateTimeInterface $updatedAt = null;#[ORM\OneToMany(mappedBy: 'poll', targetEntity: 'PollQuestion', cascade: ['persist', 'remove'], orphanRemoval: true)]private Collection $questions;public function __construct(){$this->questions = new ArrayCollection();$this->setCreatedAt(new \DateTime());}public function __toString(): string{return $this->title;}public function getId(): ?int{return $this->id;}public function getTitle(): ?string{return $this->title;}public function setTitle(?string $title): self{$this->title = $title;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 getQuestions(): Collection{return $this->questions;}public function setQuestions(Collection $questions): self{$this->questions = $questions;return $this;}public function addQuestion(PollQuestion $question): self{$question->setPoll($this);$this->questions->add($question);return $this;}public function removeQuestion(PollQuestion $question): self{$this->questions->removeElement($question);return $this;}#[ORM\PrePersist]#[ORM\PreUpdate]public function updatedTimestamps(): void{$this->setUpdatedAt(new \DateTime());if (null === $this->getCreatedAt()) {$this->setCreatedAt(new \DateTime());}}}