ninesurvey/src/ninesurvey-1.0/src/Entity/Guest.php

207 lines
3.9 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\GuestRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=GuestRepository::class)
*/
class Guest
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(name="email", type="string", length=255)
*/
private $email;
/**
* @ORM\Column(name="display_name", type="string", length=50)
*/
private $displayName;
/**
* @ORM\Column(name="keyaccess", type="string", length=255)
*/
private $key;
/**
* @ORM\Column(name="tonotifyguest", type="boolean")
*/
private $tonotifyguest;
/**
* @ORM\Column(name="tonotifyowner", type="boolean")
*/
private $tonotifyowner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Survey", inversedBy="guests")
*/
private $survey;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="guests")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Vote", mappedBy="guest", cascade={"persist"}, orphanRemoval=true)
*/
private $votes;
/**
* Calculate
* jsonvotes = formatage des votes du guest en une chaine json
*/
private $jsonvotes;
public function __construct()
{
$this->votes = new ArrayCollection();
}
public function setJsonvotes(string $jsonvotes): self
{
$this->jsonvotes = $jsonvotes;
return $this;
}
public function getJsonvotes(): ?string
{
return $this->jsonvotes;
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getDisplayName(): ?string
{
return $this->displayName;
}
public function setDisplayName(string $displayName): self
{
$this->displayName = $displayName;
return $this;
}
public function getKey(): ?string
{
return $this->key;
}
public function setKey(string $key): self
{
$this->key = $key;
return $this;
}
public function getTonotifyguest(): ?bool
{
return $this->tonotifyguest;
}
public function setTonotifyguest(bool $tonotifyguest): self
{
$this->tonotifyguest = $tonotifyguest;
return $this;
}
public function getTonotifyowner(): ?bool
{
return $this->tonotifyowner;
}
public function setTonotifyowner(bool $tonotifyowner): self
{
$this->tonotifyowner = $tonotifyowner;
return $this;
}
public function getSurvey(): ?Survey
{
return $this->survey;
}
public function setSurvey(?Survey $survey): self
{
$this->survey = $survey;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection|Vote[]
*/
public function getVotes(): Collection
{
return $this->votes;
}
public function addVote(Vote $vote): self
{
if (!$this->votes->contains($vote)) {
$this->votes[] = $vote;
$vote->setGuest($this);
}
return $this;
}
public function removeVote(Vote $vote): self
{
if ($this->votes->removeElement($vote)) {
// set the owning side to null (unless already changed)
if ($vote->getGuest() === $this) {
$vote->setGuest(null);
}
}
return $this;
}
}