@@ 141-153 (lines=13) @@ | ||
138 | $this->repository->save($institutionConfiguration); |
|
139 | } |
|
140 | ||
141 | public function handleRemoveInstitutionConfigurationByUnnormalizedIdCommand( |
|
142 | RemoveInstitutionConfigurationByUnnormalizedIdCommand $command |
|
143 | ) { |
|
144 | $institution = new Institution($command->institution); |
|
145 | ||
146 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
147 | $institutionConfiguration = $this->repository->load( |
|
148 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
149 | ); |
|
150 | $institutionConfiguration->destroy(); |
|
151 | ||
152 | $this->repository->save($institutionConfiguration); |
|
153 | } |
|
154 | ||
155 | /** |
|
156 | * @deprecated Should be used until existing institution configurations have been migrated to using normalized ids |
|
@@ 161-176 (lines=16) @@ | ||
158 | * @param Institution $institution |
|
159 | * @return InstitutionConfiguration |
|
160 | */ |
|
161 | private function loadInstitutionConfigurationFor(Institution $institution) |
|
162 | { |
|
163 | try { |
|
164 | $institutionConfigurationId = InstitutionConfigurationId::normalizedFrom($institution); |
|
165 | $institutionConfiguration = $this->repository->load( |
|
166 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
167 | ); |
|
168 | } catch (AggregateNotFoundException $exception) { |
|
169 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
170 | $institutionConfiguration = $this->repository->load( |
|
171 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
172 | ); |
|
173 | } |
|
174 | ||
175 | return $institutionConfiguration; |
|
176 | } |
|
177 | } |
|
178 |