Completed
Pull Request — master (#30)
by nonanerz
05:40
created

SurveyTypeSection::getOrderNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
 * 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="AppBundle\Entity\Survey\SurveyType", inversedBy="sections")
70
     * @ORM\JoinColumn(onDelete="CASCADE")
71
     */
72
    private $surveyType;
73
74
    /**
75
     * @var ArrayCollection[SurveyQuestion]
76
     * @ORM\OneToMany(targetEntity="SurveyQuestion", mappedBy="surveyTypeSection", cascade={"persist", "remove"})
77
     * @Groups({"group2"})
78
     */
79
    private $questions;
80
81
    public function __construct()
82
    {
83
        $this->questions = new ArrayCollection();
84
    }
85
86
    /**
87
     * Get id.
88
     *
89
     * @return int
90
     */
91
    public function getId()
92
    {
93
        return $this->id;
94
    }
95
96
    /**
97
     * Set name.
98
     *
99
     * @param string $name
100
     *
101
     * @return SurveyTypeSection
102
     */
103
    public function setName($name)
104
    {
105
        $this->name = $name;
106
107
        return $this;
108
    }
109
110
    /**
111
     * Get name.
112
     *
113
     * @return string
114
     */
115 3
    public function getName()
116
    {
117 3
        return $this->name;
118
    }
119
120
    /**
121
     * Set description.
122
     *
123
     * @param string $description
124
     *
125
     * @return SurveyTypeSection
126
     */
127
    public function setDescription($description)
128
    {
129
        $this->description = $description;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Get description.
136
     *
137
     * @return string
138
     */
139 3
    public function getDescription()
140
    {
141 3
        return $this->description;
142
    }
143
144
    /**
145
     * Set order number.
146
     *
147
     * @param int $number
148
     *
149
     * @return SurveyTypeSection
150
     */
151
    public function setOrderNumber($number)
152
    {
153
        $this->orderNumber = $number;
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get order number.
160
     *
161
     * @return int
162
     */
163
    public function getOrderNumber()
164
    {
165
        return $this->orderNumber;
166
    }
167
168
    /**
169
     * Set survey type.
170
     *
171
     * @param SurveyType $type
172
     *
173
     * @return SurveyTypeSection
174
     */
175
    public function setSurveyType(SurveyType $type)
176
    {
177
        $this->surveyType = $type;
178
179
        return $this;
180
    }
181
182
    /**
183
     * Get type.
184
     *
185
     * @return SurveyType
186
     */
187
    public function getSurveyType()
188
    {
189
        return $this->surveyType;
190
    }
191
192
    /**
193
     * Get Questions.
194
     *
195
     * @return ArrayCollection
196
     */
197 4
    public function getQuestions()
198
    {
199 4
        return $this->questions;
200
    }
201
202
    /**
203
     * Add question.
204
     *
205
     * @param \AppBundle\Entity\Survey\SurveyQuestion $question
206
     *
207
     * @return SurveyTypeSection
208
     */
209
    public function addQuestion(\AppBundle\Entity\Survey\SurveyQuestion $question)
210
    {
211
        $this->questions[] = $question;
212
213
        return $this;
214
    }
215
216
    /**
217
     * Remove question.
218
     *
219
     * @param \AppBundle\Entity\Survey\SurveyQuestion $question
220
     */
221
    public function removeQuestion(\AppBundle\Entity\Survey\SurveyQuestion $question)
222
    {
223
        $this->questions->removeElement($question);
224
    }
225
}
226