Completed
Push — develop ( 62651e...ddc457 )
by
unknown
09:17
created

JobSnapshot::getHistory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
    protected $snapshotAttributes = [
48
        'title', 'company', 'organization', 'contactEmail', 'language',
49
        'location', 'locations', 'link', 'datePublishStart', 'datePublishEnd',
50
        'reference', 'atsEnabled', 'template', 'uriApply', 'templateValues',
51
        'classifications', 'atsMode', 'metaData',
52
    ];
53
54
    public function getId()
55
    {
56
        return $this->proxy('getId');
57
    }
58
59
    public function getSnapshotId()
60
    {
61
        return $this->id;
62
    }
63
64
    public function getResourceId()
65
    {
66
        return $this->proxy('getResourceId');
67
    }
68
69
    public function setApplyId($applyId)
70
    {
71
        $this->immutable('applyId');
72
    }
73
74
    public function getApplyId()
75
    {
76
        return $this->proxy('getApplyId');
77
    }
78
79
    public function setUser(UserInterface $user)
80
    {
81
        $this->immutable('user');
82
    }
83
84
    public function getUser()
85
    {
86
        return $this->proxy('getUser');
87
    }
88
89
    public function unsetUser($removePermissions = true)
90
    {
91
        $this->immutable('user');
92
    }
93
94
    public function setApplications(Collection $applications)
95
    {
96
        $this->immutable('applications');
97
    }
98
99
    public function getApplications()
100
    {
101
        return $this->proxy('getApplications');
102
    }
103
104
    public function getUnreadApplications()
105
    {
106
        return $this->proxy('getUnreadApplications');
107
    }
108
109
110
    public function changeStatus($status, $message = '[System]')
111
    {
112
        $this->immutable('status');
113
    }
114
115
    public function getStatus()
116
    {
117
        return $this->proxy('getStatus');
118
    }
119
120
    public function setStatus($status)
121
    {
122
        $this->immutable('status');
123
    }
124
125
    public function setHistory(Collection $history)
126
    {
127
        $this->immutable('history');
128
    }
129
130
    public function getHistory()
131
    {
132
        return $this->proxy('getHistory');
133
    }
134
135
    public function setTermsAccepted($termsAccepted)
136
    {
137
        $this->immutable('termsAccepted');
138
    }
139
140
    public function getTermsAccepted()
141
    {
142
        return $this->proxy('getTermsAccepted');
143
    }
144
145
    public function getUriPublisher()
146
    {
147
        return $this->proxy('getUriPublisher');
148
    }
149
150
    public function setUriPublisher($uriPublisher)
151
    {
152
        $this->immutable('uriPublisher');
153
    }
154
155
    public function getPublisher($key)
156
    {
157
        $this->inaccessible('publisher');
158
    }
159
160
    public function setPublisherReference($key, $reference)
161
    {
162
        $this->immutable('publisherReference');
163
    }
164
165
    public function getPermissions()
166
    {
167
        if (!$this->permissions) {
168
            $originalPermissions = $this->getSnapshotMeta()->getEntity()->getPermissions();
169
            $permissions = new Permissions('Job/Permissions');
170
            $permissions->inherit($originalPermissions);
171
            $this->permissions = $permissions;
172
        }
173
174
        return clone $this->permissions;
175
    }
176
177
    public function setPermissions(PermissionsInterface $permissions)
178
    {
179
        $this->immutable('permissions');
180
    }
181
182
    public function setPortals(array $portals)
183
    {
184
        $this->immutable('portals');
185
    }
186
187
    public function getPortals()
188
    {
189
        return $this->proxy('getPortals');
190
    }
191
192
    public function isActive()
193
    {
194
        return $this->proxy('isActive');
195
    }
196
197
    public function getDateCreated()
198
    {
199
    }
200
201
    public function setDateCreated($dateCreated = null)
202
    {
203
    }
204
205
    public function getDateModified()
206
    {
207
    }
208
209
    public function setDateModified($dateModified = null)
210
    {
211
    }
212
}
213