1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00
date-poll-api/src/Entity/Vote.php

108 lines
2.1 KiB
PHP

<?php
namespace App\Entity;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass="App\Repository\VoteRepository")
*/
class Vote {
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Type("string")
*/
public $pseudo;
/**
* for a text kind of choice: could be "yes" "no" "maybe" and emptu.
* for a date kind, the choice linked is equivalent to the value selected
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Type("string")
*/
public $value;
/**
* @ORM\Column(type="datetime")
* @Serializer\Type("datetime")
*/
public $creationDate;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Choice", inversedBy="votes")
* @ORM\JoinColumn(nullable=false)
* @Serializer\Type("App\Entity\choice")
*/
public $choice;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @Serializer\Type("integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Poll", inversedBy="votes")
* @ORM\JoinColumn(nullable=false)
* @Serializer\Type("App\Entity\Poll")
*/
private $poll;
public function __construct() {
$this->setCreationDate( new \DateTime() );
}
public function getId(): ?int {
return $this->id;
}
public function getPoll(): ?Poll {
return $this->poll;
}
public function setPoll( ?Poll $poll ): self {
$this->poll = $poll;
return $this;
}
public function getPseudo(): ?string {
return $this->pseudo;
}
public function setPseudo( ?string $pseudo ): self {
$this->pseudo = $pseudo;
return $this;
}
public function getChoice(): ?Choice {
return $this->choice;
}
public function setChoice( ?Choice $choice ): self {
$this->choice = $choice;
return $this;
}
public function getValue(): ?string {
return $this->value;
}
public function setValue( ?string $value ): self {
$this->value = $value;
return $this;
}
public function getCreationDate(): ?DateTimeInterface {
return $this->creationDate;
}
public function setCreationDate( DateTimeInterface $creationDate ): self {
$this->creationDate = $creationDate;
return $this;
}
}