<?php
namespace App\AtechNet\CoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\OrderBy;
use Doctrine\ORM\Mapping\Table as Table;
/**
* @Table(name="survey_questions")
* @Entity()
*/
class SurveyQuestion extends AbstractSignedEntity
{
public const TYPE_SHORT_TEXT = 1;
public const TYPE_LONG_TEXT = 2;
public const TYPE_OPTIONS = 3;
public const TYPE_CHECKBOXES = 4;
public const TYPE_SCALE = 5;
/**
* @return array
*/
public static function getTypeChoices()
{
return [
self::TYPE_SHORT_TEXT => 'short text',
self::TYPE_LONG_TEXT => 'long text',
self::TYPE_OPTIONS => 'options',
self::TYPE_CHECKBOXES => 'checkboxes',
self::TYPE_SCALE => 'scale',
];
}
/**
* @var Survey
*
* @ManyToOne(targetEntity="Survey", inversedBy="questions")
* @JoinColumn(name="survey_id", referencedColumnName="id")
*/
private $survey;
/**
* @var int
*
* @Column(name="type", type="integer")
*/
private $type;
/**
* @var string
*
* @Column(name="question", type="text", nullable=false)
*/
private $question;
/**
* @var int
*
* @Column(name="sort_index", type="integer")
*/
private $sortIndex;
/**
* @var ArrayCollection
*
* @OneToMany(targetEntity="SurveyQuestionOption", mappedBy="question", orphanRemoval=true)
* @OrderBy({"sortIndex" = "ASC"})
**/
private $options;
/**
* @var ArrayCollection
*
* @OneToMany(targetEntity="SurveyAnswer", mappedBy="question", orphanRemoval=true)
* @OrderBy({"created" = "DESC"})
**/
private $answers;
/**
* @var ArrayCollection
*
* @OneToMany(targetEntity="SurveyMedia", mappedBy="question", orphanRemoval=true)
* @OrderBy({"created" = "DESC"})
**/
private $medias;
/**
* @return Survey
*/
public function getSurvey()
{
return $this->survey;
}
/**
* @param Survey $survey
*/
public function setSurvey($survey)
{
$this->survey = $survey;
}
/**
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* @param int $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getQuestion()
{
return $this->question;
}
/**
* @param string $question
*/
public function setQuestion($question)
{
$this->question = $question;
}
/**
* @return int
*/
public function getSortIndex()
{
return $this->sortIndex;
}
/**
* @param int $sortIndex
*/
public function setSortIndex($sortIndex)
{
$this->sortIndex = $sortIndex;
}
/**
* @return ArrayCollection
*/
public function getOptions()
{
return $this->options;
}
/**
* @return ArrayCollection
*/
public function getAnswers()
{
return $this->answers;
}
/**
* @return ArrayCollection
*/
public function getMedias()
{
return $this->medias;
}
}