1 | <?php |
||
12 | abstract class ProjectModel |
||
13 | { |
||
14 | /** @var string */ |
||
15 | protected $name; |
||
16 | /** @var string */ |
||
17 | protected $slug; |
||
18 | /** @var string **/ |
||
19 | protected $description; |
||
20 | /** @var \DateTime */ |
||
21 | protected $createdAt; |
||
22 | /** @var int */ |
||
23 | protected $nbBetaTesters; |
||
24 | /** @var string */ |
||
25 | protected $betaTestStatus; |
||
26 | /** |
||
27 | * @var object |
||
28 | * |
||
29 | * The mapping to the user class must be done by the end-user |
||
30 | */ |
||
31 | protected $productOwner; |
||
32 | |||
33 | /** |
||
34 | * @var ArrayCollection |
||
35 | * |
||
36 | * The mapping to the features can be done by the end-user but is optionnal |
||
37 | */ |
||
38 | protected $features; |
||
39 | |||
40 | /** |
||
41 | * @var ArrayCollection |
||
42 | * |
||
43 | * The mapping to the feedbacks can be done by the end-user but is optionnal |
||
44 | */ |
||
45 | protected $feedbacks; |
||
46 | |||
47 | 15 | public function __construct() { |
|
48 | 15 | $this->features = new ArrayCollection(); |
|
49 | 15 | $this->feedbacks = new ArrayCollection(); |
|
50 | 15 | } |
|
51 | |||
52 | /** |
||
53 | * Set name |
||
54 | * |
||
55 | * @param string $name |
||
56 | * |
||
57 | * @return ProjectModel |
||
58 | */ |
||
59 | 5 | public function setName($name) |
|
65 | |||
66 | /** |
||
67 | * Get name |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 4 | public function getName() |
|
75 | |||
76 | /** |
||
77 | * Set slug |
||
78 | * |
||
79 | * @param string $slug |
||
80 | * |
||
81 | * @return ProjectModel |
||
82 | */ |
||
83 | 5 | public function setSlug($slug) |
|
89 | |||
90 | /** |
||
91 | * Get slug |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | 4 | public function getSlug() |
|
99 | |||
100 | /** |
||
101 | * @param string $description |
||
102 | * @return ProjectModel |
||
103 | */ |
||
104 | public function setDescription($description) { |
||
105 | $this->description = $description; |
||
106 | |||
107 | return $this; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getDescription() { |
||
114 | return $this->description; |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Set createdAt |
||
119 | * |
||
120 | * @param \DateTime $createdAt |
||
121 | * |
||
122 | * @return ProjectModel |
||
123 | */ |
||
124 | 4 | public function setCreatedAt($createdAt) |
|
130 | |||
131 | /** |
||
132 | * Get createdAt |
||
133 | * |
||
134 | * @return \DateTime |
||
135 | */ |
||
136 | 1 | public function getCreatedAt() |
|
140 | |||
141 | /** |
||
142 | * Set updatedAt |
||
143 | * |
||
144 | * @param \DateTime $updatedAt |
||
145 | * |
||
146 | * @return ProjectModel |
||
147 | */ |
||
148 | public function setUpdatedAt($updatedAt) |
||
149 | { |
||
150 | $this->updatedAt = $updatedAt; |
||
|
|||
151 | |||
152 | return $this; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * Get updatedAt |
||
157 | * |
||
158 | * @return \DateTime |
||
159 | */ |
||
160 | public function getUpdatedAt() |
||
161 | { |
||
162 | return $this->updatedAt; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * Set nbBetaTesters |
||
167 | * |
||
168 | * @param integer $nbBetaTesters |
||
169 | * |
||
170 | * @return ProjectModel |
||
171 | */ |
||
172 | 5 | public function setNbBetaTesters($nbBetaTesters) |
|
178 | |||
179 | /** |
||
180 | * Get nbBetaTesters |
||
181 | * |
||
182 | * @return int |
||
183 | */ |
||
184 | 2 | public function getNbBetaTesters() |
|
188 | |||
189 | /** |
||
190 | * Set betaTestStatus |
||
191 | * |
||
192 | * @param string $betaTestStatus |
||
193 | * |
||
194 | * @return ProjectModel |
||
195 | */ |
||
196 | 5 | public function setBetaTestStatus($betaTestStatus) |
|
202 | |||
203 | /** |
||
204 | * Get betaTestStatus |
||
205 | * |
||
206 | * @return string |
||
207 | */ |
||
208 | 2 | public function getBetaTestStatus() |
|
212 | |||
213 | /** |
||
214 | * Set productOwner |
||
215 | * |
||
216 | * @param object $productOwner |
||
217 | * |
||
218 | * @return ProjectModel |
||
219 | */ |
||
220 | 4 | public function setProductOwner($productOwner) |
|
226 | |||
227 | /** |
||
228 | * Get productOwner |
||
229 | * |
||
230 | * @return object |
||
231 | */ |
||
232 | 2 | public function getProductOwner() |
|
236 | |||
237 | /** |
||
238 | * @param FeatureModel $feature |
||
239 | * @return ProjectModel |
||
240 | */ |
||
241 | 2 | public function addFeature(FeatureModel $feature) { |
|
246 | |||
247 | /** |
||
248 | * @param FeatureModel $feature |
||
249 | * @return ProjectModel |
||
250 | */ |
||
251 | 1 | public function removeFeature(FeatureModel $feature) { |
|
256 | |||
257 | /** |
||
258 | * @param FeatureModel $feature |
||
259 | * @return boolean |
||
260 | */ |
||
261 | 1 | public function hasFeature(FeatureModel $feature) { |
|
264 | |||
265 | /** |
||
266 | * @return ArrayCollection |
||
267 | */ |
||
268 | 1 | public function getFeatures() { |
|
271 | |||
272 | /** |
||
273 | * @param FeedbackModel $feedback |
||
274 | * @return ProjectModel |
||
275 | */ |
||
276 | 1 | public function addFeedback(FeedbackModel $feedback) { |
|
277 | 1 | $this->feedbacks->add($feedback); |
|
278 | |||
279 | 1 | return $this; |
|
280 | } |
||
281 | |||
282 | /** |
||
283 | * @param FeedbackModel $feedback |
||
284 | * @return ProjectModel |
||
285 | */ |
||
286 | 1 | public function removeFeedback(FeedbackModel $feedback) { |
|
291 | |||
292 | /** |
||
293 | * @param FeedbackModel $feedback |
||
294 | * @return boolean |
||
295 | */ |
||
296 | 1 | public function hasFeedback(FeedbackModel $feedback) { |
|
299 | |||
300 | /** |
||
301 | * @return ArrayCollection |
||
302 | */ |
||
303 | 1 | public function getFeedbacks() { |
|
306 | } |
||
307 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: