1 | <?php |
||
53 | class RaCandidateProjector extends Projector |
||
54 | { |
||
55 | /** |
||
56 | * @var RaCandidateRepository |
||
57 | */ |
||
58 | private $raCandidateRepository; |
||
59 | |||
60 | /** |
||
61 | * @var RaListingRepository |
||
62 | */ |
||
63 | private $raListingRepository; |
||
64 | |||
65 | /** |
||
66 | * @var institutionAuthorizationRepository |
||
67 | */ |
||
68 | private $institutionAuthorizationRepository; |
||
69 | /** |
||
70 | * @var IdentityRepository |
||
71 | */ |
||
72 | private $identityRepository; |
||
73 | |||
74 | public function __construct( |
||
75 | RaCandidateRepository $raCandidateRepository, |
||
76 | RaListingRepository $raListingRepository, |
||
77 | InstitutionAuthorizationRepository $institutionAuthorizationRepository, |
||
78 | IdentityRepository $identityRepository |
||
79 | ) { |
||
80 | $this->raCandidateRepository = $raCandidateRepository; |
||
81 | $this->raListingRepository = $raListingRepository; |
||
82 | $this->institutionAuthorizationRepository = $institutionAuthorizationRepository; |
||
|
|||
83 | $this->identityRepository = $identityRepository; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param VettedSecondFactorRevokedEvent $event |
||
88 | * @return void |
||
89 | */ |
||
90 | public function applyVettedSecondFactorRevokedEvent(VettedSecondFactorRevokedEvent $event) |
||
91 | { |
||
92 | $this->raCandidateRepository->removeByIdentityId($event->identityId); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @param CompliedWithVettedSecondFactorRevocationEvent $event |
||
97 | * @return void |
||
98 | */ |
||
99 | public function applyCompliedWithVettedSecondFactorRevocationEvent( |
||
100 | CompliedWithVettedSecondFactorRevocationEvent $event |
||
101 | ) { |
||
102 | $this->raCandidateRepository->removeByIdentityId($event->identityId); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @param SraaUpdatedEvent $event |
||
107 | * |
||
108 | * Removes all RaCandidates that have a nameId matching an SRAA, as they cannot be made RA(A) as they |
||
109 | * already are SRAA. |
||
110 | */ |
||
111 | public function applySraaUpdatedEvent(SraaUpdatedEvent $event) |
||
112 | { |
||
113 | $this->raCandidateRepository->removeByNameIds($event->sraaList); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param IdentityAccreditedAsRaForInstitutionEvent $event |
||
118 | * @return void |
||
119 | */ |
||
120 | public function applyIdentityAccreditedAsRaForInstitutionEvent(IdentityAccreditedAsRaForInstitutionEvent $event) |
||
121 | { |
||
122 | $this->raCandidateRepository->removeByIdentityIdAndRaInstitution($event->identityId, $event->raInstitution); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @param IdentityAccreditedAsRaaForInstitutionEvent $event |
||
127 | * @return void |
||
128 | */ |
||
129 | public function applyIdentityAccreditedAsRaaForInstitutionEvent(IdentityAccreditedAsRaaForInstitutionEvent $event) |
||
130 | { |
||
131 | $this->raCandidateRepository->removeByIdentityIdAndRaInstitution($event->identityId, $event->raInstitution); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * @param RegistrationAuthorityRetractedForInstitutionEvent $event |
||
136 | * @return void |
||
137 | */ |
||
138 | public function applyRegistrationAuthorityRetractedForInstitutionEvent(RegistrationAuthorityRetractedForInstitutionEvent $event) |
||
139 | { |
||
140 | $this->addCandidateToProjection( |
||
141 | $event->identityInstitution, |
||
142 | $event->identityId, |
||
143 | $event->nameId, |
||
144 | $event->commonName, |
||
145 | $event->email |
||
146 | ); |
||
147 | } |
||
148 | |||
149 | protected function applyIdentityForgottenEvent(IdentityForgottenEvent $event) |
||
150 | { |
||
151 | $this->raCandidateRepository->removeByIdentityId($event->identityId); |
||
152 | } |
||
153 | |||
154 | protected function applySelectRaaOptionChangedEvent(SelectRaaOptionChangedEvent $event) |
||
155 | { |
||
156 | $authorizedInstitutions = $event->selectRaaOption->getInstitutions($event->institution); |
||
157 | $this->updateInstitutionCandidatesFromCollection(new Institution($event->institution->getInstitution()), $authorizedInstitutions); |
||
158 | } |
||
159 | |||
160 | protected function applyInstitutionConfigurationRemovedEvent(InstitutionConfigurationRemovedEvent $event) |
||
161 | { |
||
162 | $this->raCandidateRepository->removeByRaInstitution(new Institution($event->institution->getInstitution())); |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * This method is kept to be backwards compatible for changes before FGA |
||
167 | * |
||
168 | * @param IdentityAccreditedAsRaEvent $event |
||
169 | * @return void |
||
170 | */ |
||
171 | public function applyIdentityAccreditedAsRaEvent(IdentityAccreditedAsRaEvent $event) |
||
175 | |||
176 | /** |
||
177 | * This method is kept to be backwards compatible for changes before FGA |
||
178 | * |
||
179 | * @param IdentityAccreditedAsRaaEvent $event |
||
180 | * @return void |
||
181 | */ |
||
182 | public function applyIdentityAccreditedAsRaaEvent(IdentityAccreditedAsRaaEvent $event) |
||
183 | { |
||
184 | $this->raCandidateRepository->removeByIdentityIdAndRaInstitution($event->identityId, $event->identityInstitution); |
||
185 | } |
||
186 | |||
187 | /** |
||
188 | * This method is kept to be backwards compatible for changes before FGA |
||
189 | * |
||
190 | * @param RegistrationAuthorityRetractedEvent $event |
||
191 | * @return void |
||
192 | */ |
||
193 | public function applyRegistrationAuthorityRetractedEvent(RegistrationAuthorityRetractedEvent $event) |
||
206 | |||
207 | /** |
||
208 | * @param Institution $institution |
||
209 | * @param ConfigurationInstitution[] $authorizedInstitutions |
||
210 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
211 | */ |
||
212 | private function updateInstitutionCandidatesFromCollection(Institution $institution, array $authorizedInstitutions) |
||
253 | |||
254 | /** |
||
255 | * @param Institution $identityInstitution |
||
256 | * @param IdentityId $identityId |
||
257 | * @param NameId $identityNameId |
||
258 | * @param CommonName $identityCommonName |
||
259 | * @param Email $identityEmail |
||
260 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
261 | */ |
||
262 | private function addCandidateToProjection( |
||
299 | } |
||
300 |
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..