<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Result
*
* @ORM\Table(name="result")
* @ORM\Entity(repositoryClass="App\Repository\ResultRepository")
*/
class Result
{
const STATUS = [
0 => 'En attente',
1 => 'Fait'
];
/**
* @var string
* @ORM\Id
* @ORM\Column(name="id", type="string")
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="date", type="datetime")
*/
private $date;
/**
*
* @ORM\ManyToOne(targetEntity="Survey", inversedBy="results" ,cascade={"persist"})
* @ORM\JoinColumn(name="survey_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $survey;
/**
*
* @ORM\OneToMany(targetEntity="Answer", mappedBy="result" ,cascade={"persist"})
*/
private $answers;
/**
* @var int
*
* @ORM\Column(name="status", type="integer")
*/
private $status;
/**
* @var string
*
* @ORM\Column(name="visits", type="integer")
*/
private $visits;
/**
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="results")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $user;
public function __construct()
{
}
/**
* Get id
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set date
*
* @param \DateType $date
*
* @return Result
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateType
*/
public function getDate()
{
return $this->date;
}
/**
* Set survey
*
* @param \App\Entity\Survey $survey
*
* @return Result
*/
public function setSurvey(\App\Entity\Survey $survey)
{
$this->survey = $survey;
return $this;
}
/**
* Get survey
*
* @return int
*/
public function getSurvey()
{
return $this->survey;
}
/**
* Set answers
*
* @param \App\Entity\Answer $answers
*
* @return Result
*/
public function setAnswers(\App\Entity\Answer $answers)
{
$this->answers = $answers;
return $this;
}
/**
* Get answers
*
* @return int
*/
public function getAnswers()
{
return $this->answers;
}
/**
* Set status
*
* @param integer $status
*
* @return Result
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return int
*/
public function getStatus()
{
return $this->status;
}
/**
* Set visits
*
* @param integer $visits
*
* @return Result
*/
public function setVisits($visits)
{
$this->visits = $visits;
return $this;
}
/**
* Get visits
*
* @return int
*/
public function getVisits()
{
return $this->visits;
}
/**
* Set id
*
* @param string $id
*
* @return Result
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Add answer
*
* @param \App\Entity\Answer $answer
*
* @return Result
*/
public function addAnswer(\App\Entity\Answer $answer)
{
$this->answers[] = $answer;
return $this;
}
/**
* Remove answer
*
* @param \App\Entity\Answer $answer
*/
public function removeAnswer(\App\Entity\Answer $answer)
{
$this->answers->removeElement($answer);
}
/**
* Set user
*
* @param \App\Entity\User $user
*
* @return Result
*/
public function setUser(\App\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \App\Entity\User
*/
public function getUser()
{
return $this->user;
}
}