Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\DTO;
  4.  
  5. use AppBundle\Model\AnswerInterface;
  6. use AppBundle\Model\CategoryInterface;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8.  
  9. /**
  10. * Class QuestionDTO
  11. * @package AppBundle\DTO
  12. */
  13. class QuestionDTO implements SymfonyFormDTO
  14. {
  15.  
  16. /**
  17. * @var text
  18. * @Assert\NotBlank()
  19. */
  20. protected $question;
  21.  
  22. /**
  23. * @var CategoryInterface
  24. */
  25. protected $category;
  26.  
  27. /**
  28. * @var bool
  29. */
  30. protected $difficulty;
  31.  
  32.  
  33. /**
  34. * @var bool
  35. */
  36. protected $default;
  37. /**
  38. * @var bool
  39. */
  40. protected $status;
  41.  
  42. /**
  43. * @var array
  44. */
  45. protected $answers;
  46.  
  47.  
  48. /**
  49. * Get Class name.
  50. * @return string
  51. */
  52. public function getDataClass()
  53. {
  54. return self::class;
  55. }
  56. /**
  57. * {@inheritdoc}
  58. */
  59. function jsonSerialize()
  60. {
  61. return [
  62. $this->question,
  63. $this->difficulty,
  64. $this->status,
  65. $this->default
  66.  
  67.  
  68. ];
  69. }
  70.  
  71.  
  72. /**
  73. * @return string
  74. */
  75. public function getQuestion():string
  76. {
  77. return (string) $this->question;
  78. }
  79.  
  80.  
  81. /**
  82. * @param string|null $question
  83. * @return QuestionDTO
  84. */
  85. public function setQuestion(string $question= null):QuestionDTO
  86. {
  87. $this->question = $question;
  88. return $this;
  89. }
  90.  
  91. /**
  92. * @return CategoryInterface
  93. */
  94. public function getCategory()
  95. {
  96. return $this->category;
  97. }
  98.  
  99. /**
  100. * @param CategoryInterface $category
  101. */
  102. public function setCategory($category)
  103. {
  104. $this->category = $category;
  105. }
  106.  
  107. /**
  108. * @return bool
  109. */
  110. public function isDifficulty()
  111. {
  112. return $this->difficulty;
  113. }
  114.  
  115. /**
  116. * @param bool $difficulty
  117. */
  118. public function setDifficulty($difficulty)
  119. {
  120. $this->difficulty = $difficulty;
  121. }
  122.  
  123. /**
  124. * @return bool
  125. */
  126. public function isDefault()
  127. {
  128. return $this->default;
  129. }
  130.  
  131. /**
  132. * @param bool $default
  133. */
  134. public function setDefault($default)
  135. {
  136. $this->default = $default;
  137. }
  138.  
  139. /**
  140. * @return bool
  141. */
  142. public function isStatus()
  143. {
  144. return $this->status;
  145. }
  146.  
  147. /**
  148. * @param bool $status
  149. */
  150. public function setStatus($status)
  151. {
  152. $this->status = $status;
  153. }
  154.  
  155.  
  156. /**
  157. * @return array
  158. */
  159. public function getAnwers(): array
  160. {
  161. return $this->anwers;
  162. }
  163.  
  164. /**
  165. * @param array $activities
  166. *
  167. * @return QuestionDTO
  168. */
  169. public function setAnwers(array $activities = null): QuestionDTO
  170. {
  171. $this->anwers = $activities;
  172.  
  173. return $this;
  174. }
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement