@@ 68-94 (lines=27) @@ | ||
65 | $this->repository->save($institutionConfiguration); |
|
66 | } |
|
67 | ||
68 | public function handleAddRaLocationCommand(AddRaLocationCommand $command) |
|
69 | { |
|
70 | $institution = new Institution($command->institution); |
|
71 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
72 | ||
73 | try { |
|
74 | /** @var InstitutionConfiguration $institutionConfiguration */ |
|
75 | $institutionConfiguration = $this->repository->load( |
|
76 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
77 | ); |
|
78 | } catch (AggregateNotFoundException $exception) { |
|
79 | throw new InstitutionConfigurationNotFoundException(sprintf( |
|
80 | 'Cannot add RA location "%s": its InstitutionConfiguration with id "%s" not found', |
|
81 | $command->raLocationId, |
|
82 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
83 | )); |
|
84 | } |
|
85 | ||
86 | $institutionConfiguration->addRaLocation( |
|
87 | new RaLocationId($command->raLocationId), |
|
88 | new RaLocationName($command->raLocationName), |
|
89 | new Location($command->location), |
|
90 | new ContactInformation($command->contactInformation) |
|
91 | ); |
|
92 | ||
93 | $this->repository->save($institutionConfiguration); |
|
94 | } |
|
95 | ||
96 | public function handleChangeRaLocationCommand(ChangeRaLocationCommand $command) |
|
97 | { |
|
@@ 96-122 (lines=27) @@ | ||
93 | $this->repository->save($institutionConfiguration); |
|
94 | } |
|
95 | ||
96 | public function handleChangeRaLocationCommand(ChangeRaLocationCommand $command) |
|
97 | { |
|
98 | $institution = new Institution($command->institution); |
|
99 | $institutionConfigurationId = InstitutionConfigurationId::from($institution); |
|
100 | ||
101 | try { |
|
102 | /** @var InstitutionConfiguration $institutionConfiguration */ |
|
103 | $institutionConfiguration = $this->repository->load( |
|
104 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
105 | ); |
|
106 | } catch (AggregateNotFoundException $exception) { |
|
107 | throw new InstitutionConfigurationNotFoundException(sprintf( |
|
108 | 'Cannot change RA location "%s": its InstitutionConfiguration with id "%s" not found', |
|
109 | $command->raLocationId, |
|
110 | $institutionConfigurationId->getInstitutionConfigurationId() |
|
111 | )); |
|
112 | } |
|
113 | ||
114 | $institutionConfiguration->changeRaLocation( |
|
115 | new RaLocationId($command->raLocationId), |
|
116 | new RaLocationName($command->raLocationName), |
|
117 | new Location($command->location), |
|
118 | new ContactInformation($command->contactInformation) |
|
119 | ); |
|
120 | ||
121 | $this->repository->save($institutionConfiguration); |
|
122 | } |
|
123 | ||
124 | public function handleRemoveRaLocationCommand(RemoveRaLocationCommand $command) |
|
125 | { |