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/StackOfVotes.php

118 lines
2.3 KiB
PHP
Raw Normal View History

2019-11-11 10:44:19 +01:00
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\StackOfVotesRepository")
*/
class StackOfVotes
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="App\Entity\poll", mappedBy="stacksOfVotes")
*/
private $votes;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $pseudo;
/**
* @ORM\Column(type="string", length=255)
*/
private $modifierToken;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Owner", inversedBy="stackOfVotes")
*/
private $owner;
public function __construct()
{
$this->votes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|poll[]
*/
public function getVotes(): Collection
{
return $this->votes;
}
public function addVote(poll $vote): self
{
if (!$this->votes->contains($vote)) {
$this->votes[] = $vote;
$vote->setStacksOfVotes($this);
}
return $this;
}
public function removeVote(poll $vote): self
{
if ($this->votes->contains($vote)) {
$this->votes->removeElement($vote);
// set the owning side to null (unless already changed)
if ($vote->getStacksOfVotes() === $this) {
$vote->setStacksOfVotes(null);
}
}
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(?string $pseudo): self
{
$this->pseudo = $pseudo;
return $this;
}
public function getModifierToken(): ?string
{
return $this->modifierToken;
}
public function setModifierToken(string $modifierToken): self
{
$this->modifierToken = $modifierToken;
return $this;
}
public function getOwner(): ?Owner
{
return $this->owner;
}
public function setOwner(?Owner $owner): self
{
$this->owner = $owner;
return $this;
}
}