<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Survey
*
* @ORM\Table(name="survey")
* @ORM\Entity(repositoryClass="App\Repository\SurveyRepository")
*/
class Survey
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", nullable=true, length=255)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="string", nullable=true, length=255)
*/
private $description;
/**
* @ORM\OneToMany(targetEntity="Question", mappedBy="survey", cascade={"persist"}, orphanRemoval=true)
* @Orm\OrderBy({"position" = "ASC"})
*/
private $questions;
/**
* @ORM\ManyToMany(targetEntity="User", mappedBy="surveys", cascade={"persist"})
*/
private $users;
/**
* @ORM\OneToMany(targetEntity="Result", mappedBy="survey", cascade={"persist"})
*/
private $results;
/**
* @var bool
*
* @ORM\Column(name="active", type="boolean")
*/
private $active;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Survey
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return Survey
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set questions
*
* @param \App\Entity\Question $questions
*
* @return Survey
*/
public function setQuestions(\App\Entity\Question $questions)
{
$this->questions = $questions;
return $this;
}
/**
* Get questions
*
* @return int
*/
public function getQuestions()
{
return $this->questions;
}
/**
* Set users
*
* @param \App\Entity\User $users
*
* @return Survey
*/
public function setUsers(\App\Entity\User $users)
{
$this->users = $users;
return $this;
}
/**
* Get users
*
* @return int
*/
public function getUsers()
{
return $this->users;
}
/**
* Set active
*
* @param boolean $active
*
* @return Survey
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Constructor
*/
public function __construct()
{
$this->questions = new \Doctrine\Common\Collections\ArrayCollection();
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
$this->results = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add question
*
* @param \App\Entity\Question $question
*
* @return Survey
*/
public function addQuestion(\App\Entity\Question $question)
{
$question->addSurvey($this);
$this->questions[] = $question;
return $this;
}
/**
* Remove question
*
* @param \App\Entity\Question $question
*/
public function removeQuestion(\App\Entity\Question $question)
{
$this->questions->removeElement($question);
}
/**
* Add user
*
* @param \App\Entity\User $user
*
* @return Survey
*/
public function addUser(\App\Entity\User $user)
{
$this->users[] = $user;
$user->addSurvey($this);
return $this;
}
/**
* Remove user
*
* @param \App\Entity\User $user
*/
public function removeUser(\App\Entity\User $user)
{
$user->removeSurvey($this);
$this->users->removeElement($user);
}
/**
* Add result
*
* @param \App\Entity\Result $result
*
* @return Survey
*/
public function addResult(\App\Entity\Result $result)
{
$this->results[] = $result;
return $this;
}
/**
* Remove result
*
* @param \App\Entity\Result $result
*/
public function removeResult(\App\Entity\Result $result)
{
$this->results->removeElement($result);
}
/**
* Get results
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getResults()
{
return $this->results;
}
}