|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace Solr\Entity; |
|
10
|
|
|
|
|
11
|
|
|
use Jobs\Entity\Job; |
|
12
|
|
|
use Jobs\Entity\JobInterface; |
|
13
|
|
|
use Core\Entity\AbstractIdentifiableModificationDateAwareEntity; |
|
14
|
|
|
use ArrayAccess; |
|
15
|
|
|
use Solr\Bridge\Util; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* This class decorates an instance of JobInterface and allows returning data |
|
19
|
|
|
* from Solr result instead of data from the decorated one. |
|
20
|
|
|
* |
|
21
|
|
|
* @author Miroslav Fedeleš <[email protected]> |
|
22
|
|
|
* @since 0.27 |
|
23
|
|
|
* @package Solr\Entity |
|
24
|
|
|
*/ |
|
25
|
|
|
class JobProxy extends AbstractIdentifiableModificationDateAwareEntity implements JobInterface |
|
26
|
|
|
{ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var JobInterface |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $job; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var ArrayAccess |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $solrResult; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param JobInterface $job |
|
40
|
|
|
* @param ArrayAccess $solrResult |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct(JobInterface $job, ArrayAccess $solrResult) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->job = $job; |
|
45
|
|
|
$this->solrResult = $solrResult; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @see \Jobs\Entity\JobInterface::getApplications() |
|
50
|
|
|
*/ |
|
51
|
|
|
public function getApplications() |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->job->getApplications(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @see \Jobs\Entity\JobInterface::getApplyId() |
|
58
|
|
|
*/ |
|
59
|
|
|
public function getApplyId() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getSolrResultValue('applyId') ?: $this->job->getApplyId(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @see \Jobs\Entity\JobInterface::getAtsEnabled() |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getAtsEnabled() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->job->getAtsEnabled(); |
|
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @see \Jobs\Entity\JobInterface::getAtsMode() |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getAtsMode() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->job->getAtsMode(); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @see \Jobs\Entity\JobInterface::getCompany() |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getCompany() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->job->getCompany(); |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @see \Jobs\Entity\JobInterface::getContactEmail() |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getContactEmail() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->getSolrResultValue('applicationEmail') ?: $this->job->getContactEmail(); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @see \Jobs\Entity\JobInterface::getDatePublishEnd() |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getDatePublishEnd() |
|
100
|
|
|
{ |
|
101
|
|
|
$date = $this->getSolrResultValue('datePublishEnd'); |
|
102
|
|
|
|
|
103
|
|
|
return $date ? Util::convertSolrDateToPhpDateTime($date) : $this->job->getDatePublishEnd(); |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @see \Jobs\Entity\JobInterface::getDatePublishStart() |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getDatePublishStart() |
|
110
|
|
|
{ |
|
111
|
|
|
$date = $this->getSolrResultValue('datePublishStart'); |
|
112
|
|
|
|
|
113
|
|
|
return $date ? Util::convertSolrDateToPhpDateTime($date) : $this->job->getDatePublishStart(); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @see \Jobs\Entity\JobInterface::getHistory() |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getHistory() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->job->getHistory(); |
|
122
|
|
|
|
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @see \Jobs\Entity\JobInterface::getLanguage() |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getLanguage() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->getSolrResultValue('lang') ?: $this->job->getLanguage(); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @see \Jobs\Entity\JobInterface::getLink() |
|
135
|
|
|
*/ |
|
136
|
|
|
public function getLink() |
|
137
|
|
|
{ |
|
138
|
|
|
return $this->getSolrResultValue('link') ?: $this->job->getLink(); |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @see \Jobs\Entity\JobInterface::getLocation() |
|
143
|
|
|
*/ |
|
144
|
|
|
public function getLocation() |
|
145
|
|
|
{ |
|
146
|
|
|
// check for a locations subquery result |
|
147
|
|
|
if (isset($this->solrResult['locations']) |
|
148
|
|
|
&& $this->solrResult['locations'] instanceof ArrayAccess |
|
149
|
|
|
&& isset($this->solrResult['locations']['docs']) |
|
150
|
|
|
) |
|
151
|
|
|
{ |
|
152
|
|
|
// get concatenated list of cities from the locations |
|
153
|
|
|
$locations = trim(implode(', ', array_unique(array_map(function (ArrayAccess $doc) |
|
154
|
|
|
{ |
|
155
|
|
|
return isset($doc->city) ? trim($doc->city) : ''; |
|
|
|
|
|
|
156
|
|
|
}, $this->solrResult['locations']['docs'])))); |
|
157
|
|
|
|
|
158
|
|
|
if ($locations) { |
|
159
|
|
|
return $locations; |
|
160
|
|
|
} |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
return $this->getSolrResultValue('location') ?: $this->job->getLocation(); |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @see \Jobs\Entity\JobInterface::getLocations() |
|
168
|
|
|
*/ |
|
169
|
|
|
public function getLocations() |
|
170
|
|
|
{ |
|
171
|
|
|
return $this->job->getLocations(); |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* @see \Jobs\Entity\JobInterface::getOrganization() |
|
176
|
|
|
*/ |
|
177
|
|
|
public function getOrganization() |
|
178
|
|
|
{ |
|
179
|
|
|
return $this->job->getOrganization(); |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @see \Jobs\Entity\JobInterface::getPortals() |
|
184
|
|
|
*/ |
|
185
|
|
|
public function getPortals() |
|
186
|
|
|
{ |
|
187
|
|
|
return $this->job->getPortals(); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @see \Jobs\Entity\JobInterface::getReference() |
|
192
|
|
|
*/ |
|
193
|
|
|
public function getReference() |
|
194
|
|
|
{ |
|
195
|
|
|
return $this->job->getReference(); |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @see \Jobs\Entity\JobInterface::getStatus() |
|
200
|
|
|
*/ |
|
201
|
|
|
public function getStatus() |
|
202
|
|
|
{ |
|
203
|
|
|
return $this->job->getStatus(); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* @see \Jobs\Entity\JobInterface::getTermsAccepted() |
|
208
|
|
|
*/ |
|
209
|
|
|
public function getTermsAccepted() |
|
210
|
|
|
{ |
|
211
|
|
|
return $this->job->getTermsAccepted(); |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @see \Jobs\Entity\JobInterface::getTitle() |
|
216
|
|
|
*/ |
|
217
|
|
|
public function getTitle() |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->getSolrResultValue('title') ?: $this->job->getTitle(); |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* @see \Jobs\Entity\JobInterface::getUriApply() |
|
224
|
|
|
*/ |
|
225
|
|
|
public function getUriApply() |
|
226
|
|
|
{ |
|
227
|
|
|
return $this->job->getUriApply(); |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* @see \Jobs\Entity\JobInterface::getUriPublisher() |
|
232
|
|
|
*/ |
|
233
|
|
|
public function getUriPublisher() |
|
234
|
|
|
{ |
|
235
|
|
|
return $this->job->getUriPublisher(); |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* @see \Jobs\Entity\JobInterface::getUser() |
|
240
|
|
|
*/ |
|
241
|
|
|
public function getUser() |
|
242
|
|
|
{ |
|
243
|
|
|
return $this->job->getUser(); |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @see \Jobs\Entity\JobInterface::setApplications() |
|
248
|
|
|
*/ |
|
249
|
|
|
public function setApplications(\Doctrine\Common\Collections\Collection $applications) |
|
250
|
|
|
{ |
|
251
|
|
|
return $this->job->setApplications($applications); |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
/** |
|
255
|
|
|
* @see \Jobs\Entity\JobInterface::setApplyId() |
|
256
|
|
|
*/ |
|
257
|
|
|
public function setApplyId($applyId) |
|
258
|
|
|
{ |
|
259
|
|
|
return $this->job->setApplyId($applyId); |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* @see \Jobs\Entity\JobInterface::setAtsEnabled() |
|
264
|
|
|
*/ |
|
265
|
|
|
public function setAtsEnabled($atsEnabled) |
|
266
|
|
|
{ |
|
267
|
|
|
return $this->job->setAtsEnabled($atsEnabled); |
|
|
|
|
|
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* @see \Jobs\Entity\JobInterface::setAtsMode() |
|
272
|
|
|
*/ |
|
273
|
|
|
public function setAtsMode(\Jobs\Entity\AtsMode $mode) |
|
274
|
|
|
{ |
|
275
|
|
|
return $this->job->setAtsMode($mode); |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** |
|
279
|
|
|
* @see \Jobs\Entity\JobInterface::setCompany() |
|
280
|
|
|
*/ |
|
281
|
|
|
public function setCompany($company) |
|
282
|
|
|
{ |
|
283
|
|
|
return $this->job->setCompany($company); |
|
|
|
|
|
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @see \Jobs\Entity\JobInterface::setContactEmail() |
|
288
|
|
|
*/ |
|
289
|
|
|
public function setContactEmail($email) |
|
290
|
|
|
{ |
|
291
|
|
|
return $this->job->setContactEmail($email); |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
/** |
|
295
|
|
|
* @see \Jobs\Entity\JobInterface::setDatePublishEnd() |
|
296
|
|
|
*/ |
|
297
|
|
|
public function setDatePublishEnd($datePublishEnd) |
|
298
|
|
|
{ |
|
299
|
|
|
return $this->job->setDatePublishEnd($datePublishEnd); |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* @see \Jobs\Entity\JobInterface::setDatePublishStart() |
|
304
|
|
|
*/ |
|
305
|
|
|
public function setDatePublishStart($datePublishStart) |
|
306
|
|
|
{ |
|
307
|
|
|
return $this->job->setDatePublishStart($datePublishStart); |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
/** |
|
311
|
|
|
* @see \Jobs\Entity\JobInterface::setHistory() |
|
312
|
|
|
*/ |
|
313
|
|
|
public function setHistory(\Doctrine\Common\Collections\Collection $history) |
|
314
|
|
|
{ |
|
315
|
|
|
return $this->job->setHistory($history); |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
/** |
|
319
|
|
|
* @see \Jobs\Entity\JobInterface::setLanguage() |
|
320
|
|
|
*/ |
|
321
|
|
|
public function setLanguage($language) |
|
322
|
|
|
{ |
|
323
|
|
|
return $this->job->setLanguage($language); |
|
324
|
|
|
} |
|
325
|
|
|
|
|
326
|
|
|
/** |
|
327
|
|
|
* @see \Jobs\Entity\JobInterface::setLink() |
|
328
|
|
|
*/ |
|
329
|
|
|
public function setLink($link) |
|
330
|
|
|
{ |
|
331
|
|
|
return $this->job->setLink($link); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
/** |
|
335
|
|
|
* @see \Jobs\Entity\JobInterface::setLocation() |
|
336
|
|
|
*/ |
|
337
|
|
|
public function setLocation($location) |
|
338
|
|
|
{ |
|
339
|
|
|
return $this->job->setLocation($location); |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* @see \Jobs\Entity\JobInterface::setLocations() |
|
344
|
|
|
*/ |
|
345
|
|
|
public function setLocations($locations) |
|
346
|
|
|
{ |
|
347
|
|
|
return $this->job->setLocations($locations); |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
/** |
|
351
|
|
|
* @see \Jobs\Entity\JobInterface::setOrganization() |
|
352
|
|
|
*/ |
|
353
|
|
|
public function setOrganization(\Organizations\Entity\OrganizationInterface $organization = null) |
|
354
|
|
|
{ |
|
355
|
|
|
return $this->job->setOrganization($organization); |
|
356
|
|
|
} |
|
357
|
|
|
|
|
358
|
|
|
/** |
|
359
|
|
|
* @see \Jobs\Entity\JobInterface::setPortals() |
|
360
|
|
|
*/ |
|
361
|
|
|
public function setPortals(array $portals) |
|
362
|
|
|
{ |
|
363
|
|
|
return $this->job->setPortals($portals); |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @see \Jobs\Entity\JobInterface::setReference() |
|
368
|
|
|
*/ |
|
369
|
|
|
public function setReference($reference) |
|
370
|
|
|
{ |
|
371
|
|
|
return $this->job->setReference($reference); |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
/** |
|
375
|
|
|
* @see \Jobs\Entity\JobInterface::setStatus() |
|
376
|
|
|
*/ |
|
377
|
|
|
public function setStatus($status) |
|
378
|
|
|
{ |
|
379
|
|
|
return $this->job->setStatus($status); |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
/** |
|
383
|
|
|
* @see \Jobs\Entity\JobInterface::setTermsAccepted() |
|
384
|
|
|
*/ |
|
385
|
|
|
public function setTermsAccepted($flag) |
|
386
|
|
|
{ |
|
387
|
|
|
return $this->job->setTermsAccepted($flag); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* @see \Jobs\Entity\JobInterface::setTitle() |
|
392
|
|
|
*/ |
|
393
|
|
|
public function setTitle($title) |
|
394
|
|
|
{ |
|
395
|
|
|
return $this->job->setTitle($title); |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
/** |
|
399
|
|
|
* @see \Jobs\Entity\JobInterface::setUriApply() |
|
400
|
|
|
*/ |
|
401
|
|
|
public function setUriApply($uriApply) |
|
402
|
|
|
{ |
|
403
|
|
|
return $this->job->setUriApply($uriApply); |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
/** |
|
407
|
|
|
* @see \Jobs\Entity\JobInterface::setUriPublisher() |
|
408
|
|
|
*/ |
|
409
|
|
|
public function setUriPublisher($uriPublisher) |
|
410
|
|
|
{ |
|
411
|
|
|
return $this->job->setUriPublisher($uriPublisher); |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
/** |
|
415
|
|
|
* @see \Jobs\Entity\JobInterface::setUser() |
|
416
|
|
|
*/ |
|
417
|
|
|
public function setUser(\Auth\Entity\UserInterface $user) |
|
418
|
|
|
{ |
|
419
|
|
|
return $this->job->setUser($user); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* @see \Zend\Permissions\Acl\Resource\ResourceInterface::getResourceId() |
|
424
|
|
|
*/ |
|
425
|
|
|
public function getResourceId() |
|
426
|
|
|
{ |
|
427
|
|
|
return $this->job->getResourceId(); |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
/** |
|
431
|
|
|
* @see \Core\Entity\PermissionsAwareInterface::getPermissions() |
|
432
|
|
|
*/ |
|
433
|
|
|
public function getPermissions() |
|
434
|
|
|
{ |
|
435
|
|
|
return $this->job->getPermissions(); |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
/** |
|
439
|
|
|
* @see \Core\Entity\PermissionsAwareInterface::setPermissions() |
|
440
|
|
|
*/ |
|
441
|
|
|
public function setPermissions(\Core\Entity\PermissionsInterface $permissions) |
|
442
|
|
|
{ |
|
443
|
|
|
return $this->job->setPermissions($permissions); |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
/** |
|
447
|
|
|
* @param string $key |
|
448
|
|
|
* @return mixed |
|
449
|
|
|
*/ |
|
450
|
|
|
protected function getSolrResultValue($key) |
|
451
|
|
|
{ |
|
452
|
|
|
return isset($this->solrResult[$key]) ? $this->solrResult[$key] : null; |
|
453
|
|
|
} |
|
454
|
|
|
} |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.