diff --git a/src/Core.php b/src/Core.php index 09eca52..862bc2b 100644 --- a/src/Core.php +++ b/src/Core.php @@ -25,11 +25,15 @@ protected function getConnection($connector_id) { } public function getConnectionProfile($connector_id) { - $entity = CMRFConnector::load($connector_id); - if ($entity == NULL) { + $connector = CMRFConnector::load($connector_id); + if ($connector == NULL) { throw new \Exception("Unregistered connector '$connector_id'.", 1); } - return $this->getConnectionProfiles()[$entity->profile]; + $profiles = $this->getConnectionProfiles(); + if (!isset($profiles[$connector->profile])) { + throw new \Exception("Unregistered profile '{$connector->profile}'.", 1); + } + return $profiles[$connector->profile]; }