Code Duplication    Length = 140-143 lines in 2 locations

src/AppBundle/Entity/Survey.php 1 location

@@ 15-154 (lines=140) @@
12
 *
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyRepository")
14
 */
15
class Survey
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    private $id;
27
28
    /**
29
     * @var SurveyType
30
     * @Assert\Type("object")
31
     * @Assert\Valid
32
     * @ORM\ManyToOne(targetEntity="SurveyType", inversedBy="surveys")
33
     */
34
    private $type;
35
36
    /**
37
     * @var User
38
     * @Assert\Type("object")
39
     * @Assert\Valid
40
     * @ORM\ManyToOne(targetEntity="User", inversedBy="surveys")
41
     */
42
    private $user;
43
44
    /**
45
     * @var ArrayCollection[SurveyQuestion]
46
     * @ORM\ManyToMany(targetEntity="SurveyQuestion", mappedBy="surveys")
47
     */
48
    private $questions;
49
50
    /**
51
     * @var ArrayCollection[SurveyAnswer]
52
     * @ORM\OneToMany(targetEntity="SurveyAnswer", mappedBy="survey")
53
     */
54
    private $answers;
55
56
    public function __construct()
57
    {
58
        $this->questions = new ArrayCollection();
59
        $this->answers = new ArrayCollection();
60
    }
61
62
    /**
63
     * Get id.
64
     *
65
     * @return int
66
     */
67
    public function getId()
68
    {
69
        return $this->id;
70
    }
71
72
    /**
73
     * Set type.
74
     *
75
     * @param SurveyType $type
76
     *
77
     * @return Survey
78
     */
79
    public function setType(SurveyType $type)
80
    {
81
        $this->type = $type;
82
83
        return $this;
84
    }
85
86
    /**
87
     * Get type.
88
     *
89
     * @return SurveyType
90
     */
91
    public function getType()
92
    {
93
        return $this->type;
94
    }
95
96
    /**
97
     * Set user.
98
     *
99
     * @param User $user
100
     *
101
     * @return Survey
102
     */
103
    public function setUser(User $user)
104
    {
105
        $this->user = $user;
106
107
        return $this;
108
    }
109
110
    /**
111
     * Get user.
112
     *
113
     * @return User
114
     */
115
    public function getUser()
116
    {
117
        return $this->user;
118
    }
119
120
    /**
121
     * @param SurveyQuestion $question
122
     *
123
     * @return Survey
124
     */
125
    public function setQuestions(SurveyQuestion $question)
126
    {
127
        if (!$this->questions->contains($question)) {
128
            $this->questions->add($question);
129
            $question->setSurveys($this);
130
        }
131
132
        return $this;
133
    }
134
135
    /**
136
     * Get Questions.
137
     *
138
     * @return ArrayCollection
139
     */
140
    public function getQuestions()
141
    {
142
        return $this->questions;
143
    }
144
145
    /**
146
     * Get Questions.
147
     *
148
     * @return ArrayCollection
149
     */
150
    public function getAnswers()
151
    {
152
        return $this->answers;
153
    }
154
}
155

src/AppBundle/Entity/SurveyQuestion.php 1 location

@@ 15-157 (lines=143) @@
12
 *
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyQuestionRepository")
14
 */
15
class SurveyQuestion
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    private $id;
27
28
    /**
29
     * @var string
30
     * @Assert\NotBlank()
31
     * @Assert\Type("string")
32
     * @Assert\Length(
33
     *      max = 500
34
     * )
35
     * @ORM\Column(name="body", type="text")
36
     */
37
    private $title;
38
39
    /**
40
     * @var SurveyType
41
     * @Assert\Type("object")
42
     * @Assert\Valid
43
     * @ORM\ManyToOne(targetEntity="SurveyType", inversedBy="questions")
44
     */
45
    private $surveyType;
46
47
    /**
48
     * @var ArrayCollection[Survey]
49
     * @ORM\ManyToMany(targetEntity="Survey", inversedBy="questions")
50
     */
51
    private $surveys;
52
53
    /**
54
     * @var ArrayCollection[SurveyAnswer]
55
     * @ORM\OneToMany(targetEntity="SurveyAnswer", mappedBy="question")
56
     */
57
    private $answers;
58
59
    public function __construct()
60
    {
61
        $this->surveys = new ArrayCollection();
62
        $this->answers = new ArrayCollection();
63
    }
64
65
    /**
66
     * Get id.
67
     *
68
     * @return int
69
     */
70
    public function getId()
71
    {
72
        return $this->id;
73
    }
74
75
    /**
76
     * Set title.
77
     *
78
     * @param string $title
79
     *
80
     * @return SurveyQuestion
81
     */
82
    public function setTitle($title)
83
    {
84
        $this->title = $title;
85
86
        return $this;
87
    }
88
89
    /**
90
     * Get title.
91
     *
92
     * @return string
93
     */
94
    public function getTitle()
95
    {
96
        return $this->title;
97
    }
98
99
    /**
100
     * Set type.
101
     *
102
     * @param SurveyType $type
103
     *
104
     * @return SurveyQuestion
105
     */
106
    public function setSurveyType(SurveyType $type)
107
    {
108
        $this->surveyType = $type;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Get type.
115
     *
116
     * @return SurveyType
117
     */
118
    public function getSurveyType()
119
    {
120
        return $this->surveyType;
121
    }
122
123
    /**
124
     * @param Survey $survey
125
     *
126
     * @return SurveyQuestion
127
     */
128
    public function setSurveys(Survey $survey)
129
    {
130
        if (!$this->surveys->contains($survey)) {
131
            $this->surveys->add($survey);
132
            $survey->setQuestions($this);
133
        }
134
135
        return $this;
136
    }
137
138
    /**
139
     * Get Surveys.
140
     *
141
     * @return ArrayCollection
142
     */
143
    public function getSurveys()
144
    {
145
        return $this->surveys;
146
    }
147
148
    /**
149
     * Get Answers.
150
     *
151
     * @return ArrayCollection
152
     */
153
    public function getAnswers()
154
    {
155
        return $this->answers;
156
    }
157
}
158