Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publication types on openregister #115

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/Service/ObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,22 @@ public function __construct(
*/
private function getMapper(string $objectType): mixed
{
$objectTypeLower = strtolower($objectType);

// Get the source for the object type from the configuration
$source = $this->config->getValueString($this->appName, $objectType . '_source', 'internal');
$source = $this->config->getValueString($this->appName, $objectTypeLower . '_source', 'internal');

// If the source is 'open_registers', use the OpenRegister service
if ($source === 'openregister') {
$openRegister = $this->getOpenRegisters();
if ($openRegister === null) {
throw new Exception("OpenRegister service not available");
}
$register = $this->config->getValueString($this->appName, $objectType . '_register', '');
$register = $this->config->getValueString($this->appName, $objectTypeLower . '_register', '');
if (empty($register)) {
throw new Exception("Register not configured for $objectType");
}
$schema = $this->config->getValueString($this->appName, $objectType . '_schema', '');
$schema = $this->config->getValueString($this->appName, $objectTypeLower . '_schema', '');
if (empty($schema)) {
throw new Exception("Schema not configured for $objectType");
}
Expand Down