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