1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Knp\DoctrineBehaviors\Model as ORMBehaviors; |
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
8
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
9
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* SurveyTypeSection. |
13
|
|
|
* |
14
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyTypeSectionRepository") |
15
|
|
|
*/ |
16
|
|
|
class SurveyTypeSection |
17
|
|
|
{ |
18
|
|
|
use ORMBehaviors\Timestampable\Timestampable; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var int |
22
|
|
|
* |
23
|
|
|
* @ORM\Column(type="integer") |
24
|
|
|
* @ORM\Id |
25
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
26
|
|
|
* @Groups({"group2"}) |
27
|
|
|
*/ |
28
|
|
|
private $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
* @Assert\NotBlank() |
33
|
|
|
* @Assert\Type("string") |
34
|
|
|
* @Assert\Length( |
35
|
|
|
* min = 2, |
36
|
|
|
* max = 190 |
37
|
|
|
* ) |
38
|
|
|
* @ORM\Column(type="string", length=190, nullable=true) |
39
|
|
|
* @Groups({"group2"}) |
40
|
|
|
*/ |
41
|
|
|
private $name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
* @Assert\NotBlank() |
46
|
|
|
* @Assert\Type("string") |
47
|
|
|
* @Assert\Length( |
48
|
|
|
* min = 2, |
49
|
|
|
* max = 500 |
50
|
|
|
* ) |
51
|
|
|
* @ORM\Column(type="string", length=500, nullable=true) |
52
|
|
|
* @Groups({"group2"}) |
53
|
|
|
*/ |
54
|
|
|
private $description; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var int |
58
|
|
|
* @Assert\NotBlank() |
59
|
|
|
* @Assert\Type("integer") |
60
|
|
|
* @ORM\Column(type="integer") |
61
|
|
|
* @Groups({"group2"}) |
62
|
|
|
*/ |
63
|
|
|
private $orderNumber; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var SurveyType |
67
|
|
|
* @Assert\Type("object") |
68
|
|
|
* @Assert\Valid |
69
|
|
|
* @ORM\ManyToOne(targetEntity="SurveyType", inversedBy="sections") |
70
|
|
|
*/ |
71
|
|
|
private $surveyType; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var ArrayCollection[SurveyQuestion] |
75
|
|
|
* @ORM\OneToMany(targetEntity="SurveyQuestion", mappedBy="surveyTypeSection", cascade={"persist", "remove"}) |
76
|
|
|
* @Groups({"group2"}) |
77
|
|
|
*/ |
78
|
|
|
private $questions; |
79
|
|
|
|
80
|
|
|
public function __construct() |
81
|
|
|
{ |
82
|
|
|
$this->questions = new ArrayCollection(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Get id. |
87
|
|
|
* |
88
|
|
|
* @return int |
89
|
|
|
*/ |
90
|
|
|
public function getId() |
91
|
|
|
{ |
92
|
|
|
return $this->id; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Set name. |
97
|
|
|
* |
98
|
|
|
* @param string $name |
99
|
|
|
* |
100
|
|
|
* @return SurveyTypeSection |
101
|
|
|
*/ |
102
|
|
|
public function setName($name) |
103
|
|
|
{ |
104
|
|
|
$this->name = $name; |
105
|
|
|
|
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Get name. |
111
|
|
|
* |
112
|
|
|
* @return string |
113
|
|
|
*/ |
114
|
3 |
|
public function getName() |
115
|
|
|
{ |
116
|
3 |
|
return $this->name; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Set description. |
121
|
|
|
* |
122
|
|
|
* @param string $description |
123
|
|
|
* |
124
|
|
|
* @return SurveyTypeSection |
125
|
|
|
*/ |
126
|
|
|
public function setDescription($description) |
127
|
|
|
{ |
128
|
|
|
$this->description = $description; |
129
|
|
|
|
130
|
|
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Get description. |
135
|
|
|
* |
136
|
|
|
* @return string |
137
|
|
|
*/ |
138
|
3 |
|
public function getDescription() |
139
|
|
|
{ |
140
|
3 |
|
return $this->description; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Set order number. |
145
|
|
|
* |
146
|
|
|
* @param int $number |
147
|
|
|
* |
148
|
|
|
* @return SurveyTypeSection |
149
|
|
|
*/ |
150
|
|
|
public function setOrderNumber($number) |
151
|
|
|
{ |
152
|
|
|
$this->orderNumber = $number; |
153
|
|
|
|
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get order number. |
159
|
|
|
* |
160
|
|
|
* @return int |
161
|
|
|
*/ |
162
|
|
|
public function getOrderNumber() |
163
|
|
|
{ |
164
|
|
|
return $this->orderNumber; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Set survey type. |
169
|
|
|
* |
170
|
|
|
* @param SurveyType $type |
171
|
|
|
* |
172
|
|
|
* @return SurveyTypeSection |
173
|
|
|
*/ |
174
|
|
|
public function setSurveyType(SurveyType $type) |
175
|
|
|
{ |
176
|
|
|
$this->surveyType = $type; |
177
|
|
|
|
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Get type. |
183
|
|
|
* |
184
|
|
|
* @return SurveyType |
185
|
|
|
*/ |
186
|
|
|
public function getSurveyType() |
187
|
|
|
{ |
188
|
|
|
return $this->surveyType; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Get Questions. |
193
|
|
|
* |
194
|
|
|
* @return ArrayCollection |
195
|
|
|
*/ |
196
|
4 |
|
public function getQuestions() |
197
|
|
|
{ |
198
|
4 |
|
return $this->questions; |
199
|
|
|
} |
200
|
|
|
} |
201
|
|
|
|