1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity\Survey; |
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
|
|
|
* SurveyType. |
13
|
|
|
* |
14
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyTypeRepository") |
15
|
|
|
*/ |
16
|
|
|
class SurveyType |
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
|
|
|
*/ |
27
|
|
|
private $id; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
* @Assert\NotBlank() |
32
|
|
|
* @Assert\Type("string") |
33
|
|
|
* @Assert\Length( |
34
|
|
|
* min = 2, |
35
|
|
|
* max = 190 |
36
|
|
|
* ) |
37
|
|
|
* @ORM\Column(type="string", length=190, unique=true) |
38
|
|
|
* @Groups({"group1"}) |
39
|
|
|
*/ |
40
|
|
|
private $name; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
* @Assert\NotBlank() |
45
|
|
|
* @Assert\Type("string") |
46
|
|
|
* @Assert\Length( |
47
|
|
|
* min = 2, |
48
|
|
|
* max = 500 |
49
|
|
|
* ) |
50
|
|
|
* @ORM\Column(type="string", length=500, nullable=true) |
51
|
|
|
* @Groups({"group2"}) |
52
|
|
|
*/ |
53
|
|
|
private $description; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var ArrayCollection[SurveyTypeSection] |
57
|
|
|
* @ORM\OneToMany(targetEntity="SurveyTypeSection", mappedBy="surveyType", cascade={"persist", "remove"}) |
58
|
|
|
* @Groups({"group2"}) |
59
|
|
|
*/ |
60
|
|
|
private $sections; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var ArrayCollection[Survey] |
64
|
|
|
* @ORM\OneToMany(targetEntity="Survey", mappedBy="type", cascade={"persist", "remove"}) |
65
|
|
|
*/ |
66
|
|
|
private $surveys; |
67
|
|
|
|
68
|
|
|
public function __construct() |
69
|
|
|
{ |
70
|
|
|
$this->sections = new ArrayCollection(); |
71
|
|
|
$this->surveys = new ArrayCollection(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get id. |
76
|
|
|
* |
77
|
|
|
* @return int |
78
|
|
|
*/ |
79
|
|
|
public function getId() |
80
|
|
|
{ |
81
|
|
|
return $this->id; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set name. |
86
|
|
|
* |
87
|
|
|
* @param string $name |
88
|
|
|
* |
89
|
|
|
* @return SurveyType |
90
|
|
|
*/ |
91
|
|
|
public function setName($name) |
92
|
|
|
{ |
93
|
|
|
$this->name = $name; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get name. |
100
|
|
|
* |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
6 |
|
public function getName() |
104
|
|
|
{ |
105
|
6 |
|
return $this->name; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Set description. |
110
|
|
|
* |
111
|
|
|
* @param string $description |
112
|
|
|
* |
113
|
|
|
* @return SurveyType |
114
|
|
|
*/ |
115
|
|
|
public function setDescription($description) |
116
|
|
|
{ |
117
|
|
|
$this->description = $description; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get description. |
124
|
|
|
* |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
3 |
|
public function getDescription() |
128
|
|
|
{ |
129
|
3 |
|
return $this->description; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Get SurveysTypeSection. |
134
|
|
|
* |
135
|
|
|
* @return ArrayCollection |
136
|
|
|
*/ |
137
|
4 |
|
public function getSections() |
138
|
|
|
{ |
139
|
4 |
|
return $this->sections; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Get Surveys. |
144
|
|
|
* |
145
|
|
|
* @return ArrayCollection |
146
|
|
|
*/ |
147
|
|
|
public function getSurveys() |
148
|
|
|
{ |
149
|
|
|
return $this->surveys; |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
|