src/Entity/VoteItem.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VoteItemRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassVoteItemRepository::class)]
  7. class VoteItem
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\ManyToOne(inversedBy'voteItems')]
  14.     #[ORM\JoinColumn(nullablefalse)]
  15.     private ?User $User null;
  16.     #[ORM\ManyToOne(inversedBy'voteItems')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private ?VoteEvent $VoteEvent null;
  19.     #[ORM\ManyToOne(inversedBy'voteItems')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private ?Vendor $Vendor null;
  22.     #[ORM\Column]
  23.     private ?int $Votes null;
  24.     #[ORM\Column(typeTypes::DATETIMETZ_MUTABLE)]
  25.     private ?\DateTimeInterface $CreatedOn null;
  26.     #[ORM\Column]
  27.     private ?bool $isSkip false;
  28.     private ?int $maxVotes null;
  29.     public function __construct()
  30.     {
  31.         $this->CreatedOn = new \DateTime();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getUser(): ?User
  38.     {
  39.         return $this->User;
  40.     }
  41.     public function setUser(?User $User): self
  42.     {
  43.         $this->User $User;
  44.         return $this;
  45.     }
  46.     public function getVoteEvent(): ?VoteEvent
  47.     {
  48.         return $this->VoteEvent;
  49.     }
  50.     public function setVoteEvent(?VoteEvent $VoteEvent): self
  51.     {
  52.         $this->VoteEvent $VoteEvent;
  53.         return $this;
  54.     }
  55.     public function getVendor(): ?Vendor
  56.     {
  57.         return $this->Vendor;
  58.     }
  59.     public function setVendor(?Vendor $Vendor): self
  60.     {
  61.         $this->Vendor $Vendor;
  62.         return $this;
  63.     }
  64.     public function getVotes(): ?int
  65.     {
  66.         return $this->Votes;
  67.     }
  68.     public function setVotes(int $Votes): self
  69.     {
  70.         $this->Votes $Votes;
  71.         return $this;
  72.     }
  73.     public function getCreatedOn(): ?\DateTimeInterface
  74.     {
  75.         return $this->CreatedOn;
  76.     }
  77.     public function setCreatedOn(\DateTimeInterface $CreatedOn): self
  78.     {
  79.         $this->CreatedOn $CreatedOn;
  80.         return $this;
  81.     }
  82.     public function isIsSkip(): ?bool
  83.     {
  84.         return $this->isSkip;
  85.     }
  86.     public function setIsSkip(bool $isSkip): self
  87.     {
  88.         $this->isSkip $isSkip;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return int|null
  93.      */
  94.     public function getMaxVotes(): ?int
  95.     {
  96.         return $this->maxVotes;
  97.     }
  98.     /**
  99.      * @param int|null $maxVotes
  100.      */
  101.     public function setMaxVotes(?int $maxVotes): self
  102.     {
  103.         $this->maxVotes $maxVotes;
  104.         return $this;
  105.     }
  106.     public function __toString()
  107.     {
  108.         $temp = [
  109.             'id' => $this->id,
  110.             'vendor' => $this->Vendor->getId(),
  111.             'event' => $this->VoteEvent->getId(),
  112.             'user' => $this->User->getId(),
  113.             'votes' => $this->getVotes(),
  114.             'skipped' => $this->isSkip === true '1' '0'
  115.         ];
  116.         return json_encode($tempJSON_PRETTY_PRINT);
  117.     }
  118. }