/**
  * @param DataModelInterface $model
  *
  * @return array
  * @throws \Exception
  */
 protected function getConfig(DataModelInterface $model)
 {
     if (!$this->getServiceLocator()->has($model->_adapter)) {
         throw new \Exception('Wrong adapter name ' . $model->_adapter . ' in model ' . $model->getModelName());
     }
     return $this->getServiceLocator()->get($model->_adapter)->getDriver()->getConnection()->getConnectionParameters();
 }
 public function saveConfigToDbByObject(DataModelInterface $configObject)
 {
     $configArray = Arr::getDoubtField($this->getConfigPart($configObject->getModelName()), 'custom', []);
     foreach ($configArray as $config) {
         $object = clone $configObject;
         $object->exchangeArray($config);
         $this->getGatewayServiceVerify()->get($configObject->getModelName(), $configObject)->save($object);
     }
     return $this;
 }