1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupMiddleware\ApiBundle\Identity\Entity; |
20
|
|
|
|
21
|
|
|
use Doctrine\ORM\Mapping as ORM; |
22
|
|
|
use JsonSerializable; |
23
|
|
|
use Surfnet\Stepup\Identity\Value\CommonName; |
24
|
|
|
use Surfnet\Stepup\Identity\Value\Email; |
25
|
|
|
use Surfnet\Stepup\Identity\Value\IdentityId; |
26
|
|
|
use Surfnet\Stepup\Identity\Value\Institution; |
27
|
|
|
use Surfnet\Stepup\Identity\Value\NameId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Be aware that this entity is used for the RA Candidate view. This entity shouldn't be used to store any RA candidates. |
31
|
|
|
* The IgnoreTablesListener is used to prevent schema changes when the Doctrine Schema tool is used. |
32
|
|
|
* |
33
|
|
|
* @ORM\Table(name="view_ra_candidate") |
34
|
|
|
* @ORM\Entity(repositoryClass="Surfnet\StepupMiddleware\ApiBundle\Identity\Repository\RaCandidateRepository", readOnly=true) |
35
|
|
|
*/ |
36
|
|
|
class RaCandidate implements JsonSerializable |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @ORM\Id |
40
|
|
|
* @ORM\Column(length=36) |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
public $identityId; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ORM\Id |
48
|
|
|
* @ORM\Column(type="institution") |
49
|
|
|
* |
50
|
|
|
* @var Institution |
51
|
|
|
*/ |
52
|
|
|
public $raInstitution; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @ORM\Column(type="institution") |
56
|
|
|
* |
57
|
|
|
* @var \Surfnet\Stepup\Identity\Value\Institution |
58
|
|
|
*/ |
59
|
|
|
public $institution; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @ORM\Column(type="stepup_name_id") |
63
|
|
|
* |
64
|
|
|
* @var \Surfnet\Stepup\Identity\Value\NameId |
65
|
|
|
*/ |
66
|
|
|
public $nameId; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @ORM\Column(type="stepup_common_name") |
70
|
|
|
* |
71
|
|
|
* @var \Surfnet\Stepup\Identity\Value\CommonName |
72
|
|
|
*/ |
73
|
|
|
public $commonName; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @ORM\Column(type="stepup_email") |
77
|
|
|
* |
78
|
|
|
* @var \Surfnet\Stepup\Identity\Value\Email |
79
|
|
|
*/ |
80
|
|
|
public $email; |
81
|
|
|
|
82
|
|
|
private function __construct() |
83
|
|
|
{ |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public static function nominate( |
87
|
|
|
IdentityId $identityId, |
88
|
|
|
Institution $institution, |
89
|
|
|
NameId $nameId, |
90
|
|
|
CommonName $commonName, |
91
|
|
|
Email $email, |
92
|
|
|
Institution $raInstitution |
93
|
|
|
) { |
94
|
|
|
$candidate = new self(); |
95
|
|
|
$candidate->identityId = (string) $identityId; |
96
|
|
|
$candidate->institution = $institution; |
97
|
|
|
$candidate->nameId = $nameId; |
98
|
|
|
$candidate->commonName = $commonName; |
99
|
|
|
$candidate->email = $email; |
100
|
|
|
$candidate->raInstitution = $raInstitution; |
101
|
|
|
|
102
|
|
|
return $candidate; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
View Code Duplication |
public function jsonSerialize() |
|
|
|
|
106
|
|
|
{ |
107
|
|
|
return [ |
108
|
|
|
'identity_id' => $this->identityId, |
109
|
|
|
'institution' => $this->institution, |
110
|
|
|
'common_name' => $this->commonName, |
111
|
|
|
'email' => $this->email, |
112
|
|
|
'name_id' => $this->nameId, |
113
|
|
|
'ra_institution' => $this->raInstitution, |
114
|
|
|
]; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|