protected function ParseConfig($configData) { parent::ParseConfig($configData); //perform basic validation to ensure the config actually has db credentials //this can't be loaded twice so we need to ensure its done right if (!property_exists($this->_config, $this->JSONKey)) { throw new Exception('Unable to locate the database key in the provided config'); } $dbConfig = $this->_config->{$this->JSONKey}; $requiredKeys = ['host', 'username', 'password', 'name']; foreach ($requiredKeys as $key) { if (!property_exists($dbConfig, $key)) { throw new Exception("Unable to locate the required database key '{$key}' in the provided database config"); } } }