|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
* @author [email protected] |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Jobs\Entity; |
|
12
|
|
|
|
|
13
|
|
|
use Core\Entity\AbstractIdentifiableEntity; |
|
14
|
|
|
use Core\Entity\Collection\ArrayCollection; |
|
15
|
|
|
use Core\Entity\DraftableEntityInterface; |
|
16
|
|
|
use Core\Entity\MetaDataProviderTrait; |
|
17
|
|
|
use Core\Entity\Permissions; |
|
18
|
|
|
use Core\Entity\Snapshot as BaseEntity; |
|
19
|
|
|
use Auth\Entity\UserInterface; |
|
20
|
|
|
use Core\Entity\SnapshotAttributesProviderInterface; |
|
21
|
|
|
use Core\Entity\SnapshotTrait; |
|
22
|
|
|
use DateTime; |
|
23
|
|
|
use Doctrine\Common\Collections\Collection; |
|
24
|
|
|
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs; |
|
25
|
|
|
use Exception; |
|
26
|
|
|
use InvalidArgumentException; |
|
27
|
|
|
use Organizations\Entity\OrganizationInterface; |
|
28
|
|
|
use Core\Exception\ImmutablePropertyException; |
|
29
|
|
|
use Core\Entity\PermissionsInterface; |
|
30
|
|
|
use Organizations\Entity\Organization; |
|
31
|
|
|
use Core\Entity\SnapshotInterface; |
|
32
|
|
|
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; |
|
33
|
|
|
use Core\Entity\EntityInterface; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* by using the BaseEntity, |
|
37
|
|
|
* |
|
38
|
|
|
* Class JobSnapshot |
|
39
|
|
|
* @package Jobs\Entity |
|
40
|
|
|
* |
|
41
|
|
|
* @ODM\Document(collection="jobs.snapshots2", repositoryClass="Core\Repository\SnapshotRepository") |
|
42
|
|
|
*/ |
|
43
|
|
|
class JobSnapshot extends Job implements SnapshotInterface, SnapshotAttributesProviderInterface |
|
44
|
|
|
{ |
|
45
|
|
|
use SnapshotTrait; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* |
|
49
|
|
|
* @ODM\ReferenceOne(targetDocument="\Jobs\Entity\Job", inversedBy="snapshots", storeAs="id") |
|
50
|
|
|
* @var |
|
51
|
|
|
*/ |
|
52
|
|
|
private $snapshotEntity; |
|
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
protected $snapshotAttributes = [ |
|
55
|
|
|
'title', 'company', 'organization', 'contactEmail', 'language', |
|
56
|
|
|
'location', 'locations', 'link', 'datePublishStart', 'datePublishEnd', |
|
57
|
|
|
'reference', 'atsEnabled', 'template', 'uriApply', 'templateValues', |
|
58
|
|
|
'classifications', 'atsMode', 'metaData', |
|
59
|
|
|
]; |
|
60
|
|
|
|
|
61
|
|
|
private $snapshotDiffSpecs = [ |
|
|
|
|
|
|
62
|
|
|
'title', |
|
63
|
|
|
'company', |
|
64
|
|
|
'organization', |
|
65
|
|
|
'locations' => [ |
|
66
|
|
|
'city', 'region', 'postalcode', 'country' |
|
67
|
|
|
], |
|
68
|
|
|
'templateValues' => [ |
|
69
|
|
|
'qualifications' |
|
70
|
|
|
], |
|
71
|
|
|
]; |
|
72
|
|
|
|
|
73
|
|
|
public function getId() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->proxy('getId'); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getSnapshotId() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->id; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getSnapshotDraft() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->proxy('getSnapshotDraft'); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function hasSnapshotDraft() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->proxy('hasSnapshotDraft'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getResourceId() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->proxy('getResourceId'); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function setApplyId($applyId) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->immutable('applyId'); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getApplyId() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->proxy('getApplyId'); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function setUser(UserInterface $user) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->immutable('user'); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function getUser() |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->proxy('getUser'); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
public function unsetUser($removePermissions = true) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->immutable('user'); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
public function setApplications(Collection $applications) |
|
124
|
|
|
{ |
|
125
|
|
|
$this->immutable('applications'); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
public function getApplications() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->proxy('getApplications'); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
public function getUnreadApplications() |
|
134
|
|
|
{ |
|
135
|
|
|
return $this->proxy('getUnreadApplications'); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
|
|
139
|
|
|
public function changeStatus($status, $message = '[System]') |
|
140
|
|
|
{ |
|
141
|
|
|
$this->immutable('status'); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
public function getStatus() |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->proxyClone('getStatus'); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
public function setStatus($status) |
|
150
|
|
|
{ |
|
151
|
|
|
$this->immutable('status'); |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
public function setHistory(Collection $history) |
|
155
|
|
|
{ |
|
156
|
|
|
$this->immutable('history'); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
public function getHistory() |
|
160
|
|
|
{ |
|
161
|
|
|
return $this->proxy('getHistory'); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
public function setTermsAccepted($termsAccepted) |
|
165
|
|
|
{ |
|
166
|
|
|
$this->immutable('termsAccepted'); |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
public function getTermsAccepted() |
|
170
|
|
|
{ |
|
171
|
|
|
return $this->proxyClone('getTermsAccepted'); |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
public function getUriPublisher() |
|
175
|
|
|
{ |
|
176
|
|
|
return $this->proxy('getUriPublisher'); |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
public function setUriPublisher($uriPublisher) |
|
180
|
|
|
{ |
|
181
|
|
|
$this->immutable('uriPublisher'); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
public function getPublisher($key) |
|
185
|
|
|
{ |
|
186
|
|
|
$this->inaccessible('publisher'); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
public function setPublisherReference($key, $reference) |
|
190
|
|
|
{ |
|
191
|
|
|
$this->immutable('publisherReference'); |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
public function getPermissions() |
|
195
|
|
|
{ |
|
196
|
|
|
if (!$this->permissions) { |
|
197
|
|
|
$originalPermissions = $this->getOriginalEntity()->getPermissions(); |
|
198
|
|
|
$permissions = new Permissions('Job/Permissions'); |
|
199
|
|
|
$permissions->inherit($originalPermissions); |
|
200
|
|
|
$this->permissions = $permissions; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
return clone $this->permissions; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
public function setPermissions(PermissionsInterface $permissions) |
|
207
|
|
|
{ |
|
208
|
|
|
$this->immutable('permissions'); |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
public function setPortals(array $portals) |
|
212
|
|
|
{ |
|
213
|
|
|
$this->immutable('portals'); |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
public function getPortals() |
|
217
|
|
|
{ |
|
218
|
|
|
return $this->proxyClone('getPortals'); |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
public function isActive() |
|
222
|
|
|
{ |
|
223
|
|
|
return $this->proxy('isActive'); |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
public function getDateCreated() |
|
227
|
|
|
{ |
|
228
|
|
|
return $this->proxyClone('getDateCreated'); |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
public function setDateCreated($dateCreated = null) |
|
232
|
|
|
{ |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
public function getDateModified() |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->proxyClone('getDateModified'); |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
public function setDateModified($dateModified = null) |
|
241
|
|
|
{ |
|
242
|
|
|
} |
|
243
|
|
|
} |
|
244
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.