@@ 166-178 (lines=13) @@ | ||
163 | $this->repository->save($institutionConfiguration); |
|
164 | } |
|
165 | ||
166 | public function handleRemoveInstitutionConfigurationByUnnormalizedIdCommand( |
|
167 | RemoveInstitutionConfigurationByUnnormalizedIdCommand $command |
|
168 | ) { |
|
169 | $institution = new Institution($command->institution); |
|
170 | ||
171 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
172 | $institutionConfiguration = $this->repository->load( |
|
173 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
174 | ); |
|
175 | $institutionConfiguration->destroy(); |
|
176 | ||
177 | $this->repository->save($institutionConfiguration); |
|
178 | } |
|
179 | ||
180 | /** |
|
181 | * @deprecated Should be used until existing institution configurations have been migrated to using normalized ids |
|
@@ 186-201 (lines=16) @@ | ||
183 | * @param Institution $institution |
|
184 | * @return InstitutionConfiguration |
|
185 | */ |
|
186 | private function loadInstitutionConfigurationFor(Institution $institution) |
|
187 | { |
|
188 | try { |
|
189 | $institutionConfigurationId = InstitutionConfigurationId::normalizedFrom($institution); |
|
190 | $institutionConfiguration = $this->repository->load( |
|
191 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
192 | ); |
|
193 | } catch (AggregateNotFoundException $exception) { |
|
194 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
195 | $institutionConfiguration = $this->repository->load( |
|
196 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
197 | ); |
|
198 | } |
|
199 | ||
200 | return $institutionConfiguration; |
|
201 | } |
|
202 | } |
|
203 |
@@ 437-453 (lines=17) @@ | ||
434 | * @param Institution $institution |
|
435 | * @return InstitutionConfiguration |
|
436 | */ |
|
437 | private function loadInstitutionConfigurationFor(Institution $institution) |
|
438 | { |
|
439 | $institution = new ConfigurationInstitution($institution->getInstitution()); |
|
440 | try { |
|
441 | $institutionConfigurationId = InstitutionConfigurationId::normalizedFrom($institution); |
|
442 | $institutionConfiguration = $this->institutionConfigurationRepository->load( |
|
443 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
444 | ); |
|
445 | } catch (AggregateNotFoundException $exception) { |
|
446 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
447 | $institutionConfiguration = $this->institutionConfigurationRepository->load( |
|
448 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
449 | ); |
|
450 | } |
|
451 | ||
452 | return $institutionConfiguration; |
|
453 | } |
|
454 | } |
|
455 |
@@ 149-165 (lines=17) @@ | ||
146 | * @param Institution $institution |
|
147 | * @return InstitutionConfiguration |
|
148 | */ |
|
149 | private function loadInstitutionConfigurationFor(Institution $institution) |
|
150 | { |
|
151 | $institution = new ConfigurationInstitution($institution->getInstitution()); |
|
152 | try { |
|
153 | $institutionConfigurationId = InstitutionConfigurationId::normalizedFrom($institution); |
|
154 | $institutionConfiguration = $this->institutionConfigurationRepository->load( |
|
155 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
156 | ); |
|
157 | } catch (AggregateNotFoundException $exception) { |
|
158 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
159 | $institutionConfiguration = $this->institutionConfigurationRepository->load( |
|
160 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
161 | ); |
|
162 | } |
|
163 | ||
164 | return $institutionConfiguration; |
|
165 | } |
|
166 | } |
|
167 |