1 | <?php |
||
54 | class RaCandidateProjector extends Projector |
||
55 | { |
||
56 | /** |
||
57 | * @var RaCandidateRepository |
||
58 | */ |
||
59 | private $raCandidateRepository; |
||
60 | |||
61 | /** |
||
62 | * @var RaListingRepository |
||
63 | */ |
||
64 | private $raListingRepository; |
||
65 | |||
66 | /** |
||
67 | * @var institutionAuthorizationRepository |
||
68 | */ |
||
69 | private $institutionAuthorizationRepository; |
||
70 | /** |
||
71 | * @var IdentityRepository |
||
72 | */ |
||
73 | private $identityRepository; |
||
74 | /** |
||
75 | * @var RaSecondFactorRepository |
||
76 | */ |
||
77 | private $raSecondFactorRepository; |
||
78 | |||
79 | public function __construct( |
||
80 | RaCandidateRepository $raCandidateRepository, |
||
81 | RaListingRepository $raListingRepository, |
||
82 | InstitutionAuthorizationRepository $institutionAuthorizationRepository, |
||
83 | IdentityRepository $identityRepository, |
||
84 | RaSecondFactorRepository $raSecondFactorRepository |
||
85 | ) { |
||
86 | $this->raCandidateRepository = $raCandidateRepository; |
||
87 | $this->raListingRepository = $raListingRepository; |
||
88 | $this->institutionAuthorizationRepository = $institutionAuthorizationRepository; |
||
|
|||
89 | $this->identityRepository = $identityRepository; |
||
90 | $this->raSecondFactorRepository = $raSecondFactorRepository; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param VettedSecondFactorRevokedEvent $event |
||
95 | * @return void |
||
96 | */ |
||
97 | public function applyVettedSecondFactorRevokedEvent(VettedSecondFactorRevokedEvent $event) |
||
98 | { |
||
99 | $this->raCandidateRepository->removeByIdentityId($event->identityId); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * @param CompliedWithVettedSecondFactorRevocationEvent $event |
||
104 | * @return void |
||
105 | */ |
||
106 | public function applyCompliedWithVettedSecondFactorRevocationEvent( |
||
107 | CompliedWithVettedSecondFactorRevocationEvent $event |
||
108 | ) { |
||
109 | $this->raCandidateRepository->removeByIdentityId($event->identityId); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @param SraaUpdatedEvent $event |
||
114 | * |
||
115 | * Removes all RaCandidates that have a nameId matching an SRAA, as they cannot be made RA(A) as they |
||
116 | * already are SRAA. |
||
117 | */ |
||
118 | public function applySraaUpdatedEvent(SraaUpdatedEvent $event) |
||
119 | { |
||
120 | $this->raCandidateRepository->removeByNameIds($event->sraaList); |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * @param IdentityAccreditedAsRaForInstitutionEvent $event |
||
125 | * @return void |
||
126 | */ |
||
127 | public function applyIdentityAccreditedAsRaForInstitutionEvent(IdentityAccreditedAsRaForInstitutionEvent $event) |
||
128 | { |
||
129 | $this->raCandidateRepository->removeByIdentityIdAndRaInstitution($event->identityId, $event->raInstitution); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @param IdentityAccreditedAsRaaForInstitutionEvent $event |
||
134 | * @return void |
||
135 | */ |
||
136 | public function applyIdentityAccreditedAsRaaForInstitutionEvent(IdentityAccreditedAsRaaForInstitutionEvent $event) |
||
137 | { |
||
138 | $this->raCandidateRepository->removeByIdentityIdAndRaInstitution($event->identityId, $event->raInstitution); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @param RegistrationAuthorityRetractedForInstitutionEvent $event |
||
143 | * @return void |
||
144 | */ |
||
145 | public function applyRegistrationAuthorityRetractedForInstitutionEvent(RegistrationAuthorityRetractedForInstitutionEvent $event) |
||
146 | { |
||
147 | $this->addCandidateToProjection( |
||
148 | $event->identityInstitution, |
||
149 | $event->identityId, |
||
150 | $event->nameId, |
||
151 | $event->commonName, |
||
152 | $event->email |
||
153 | ); |
||
154 | } |
||
155 | |||
156 | protected function applyIdentityForgottenEvent(IdentityForgottenEvent $event) |
||
160 | |||
161 | protected function applySelectRaaOptionChangedEvent(SelectRaaOptionChangedEvent $event) |
||
162 | { |
||
163 | $authorizedInstitutions = $event->selectRaaOption->getInstitutions($event->institution); |
||
164 | $this->updateInstitutionCandidatesFromCollection(new Institution($event->institution->getInstitution()), $authorizedInstitutions); |
||
165 | } |
||
166 | |||
167 | protected function applyInstitutionConfigurationRemovedEvent(InstitutionConfigurationRemovedEvent $event) |
||
168 | { |
||
171 | |||
172 | /** |
||
173 | * This method is kept to be backwards compatible for changes before FGA |
||
174 | * |
||
175 | * @param IdentityAccreditedAsRaEvent $event |
||
176 | * @return void |
||
177 | */ |
||
178 | public function applyIdentityAccreditedAsRaEvent(IdentityAccreditedAsRaEvent $event) |
||
182 | |||
183 | /** |
||
184 | * This method is kept to be backwards compatible for changes before FGA |
||
185 | * |
||
186 | * @param IdentityAccreditedAsRaaEvent $event |
||
187 | * @return void |
||
188 | */ |
||
189 | public function applyIdentityAccreditedAsRaaEvent(IdentityAccreditedAsRaaEvent $event) |
||
193 | |||
194 | /** |
||
195 | * This method is kept to be backwards compatible for changes before FGA |
||
196 | * |
||
197 | * @param RegistrationAuthorityRetractedEvent $event |
||
198 | * @return void |
||
199 | */ |
||
200 | public function applyRegistrationAuthorityRetractedEvent(RegistrationAuthorityRetractedEvent $event) |
||
213 | |||
214 | /** |
||
215 | * @param Institution $institution |
||
216 | * @param ConfigurationInstitution[] $authorizedInstitutions |
||
217 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
218 | */ |
||
219 | private function updateInstitutionCandidatesFromCollection(Institution $institution, array $authorizedInstitutions) |
||
261 | |||
262 | /** |
||
263 | * @param Institution $identityInstitution |
||
264 | * @param IdentityId $identityId |
||
265 | * @param NameId $identityNameId |
||
266 | * @param CommonName $identityCommonName |
||
267 | * @param Email $identityEmail |
||
268 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
269 | */ |
||
270 | private function addCandidateToProjection( |
||
307 | } |
||
308 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..