/** * Save a DAO to the data store * * @param IDao $dao * * @return array of changed properties * * @throws DataStoreException */ public function save(IDao $dao) { $dao = $this->_verifyDao($dao); parent::save($dao); }
/** * Get the data store for this dao * * @return QlDataStore * * @throws DataStoreNotFoundException */ public function getDataStore() { $resolver = static::getDalResolver(); try { return $resolver->getDataStore($this->_dataStoreName); } catch (DataStoreNotFoundException $e) { if ($resolver->hasConnection($this->_dataStoreName)) { $config = new ConfigSection($this->_dataStoreName, ['connection' => $this->_dataStoreName]); $dataStore = new QlDataStore(); $dataStore->configure($config); $resolver->addDataStoreConfig($config); $resolver->addDataStore($this->_dataStoreName, $dataStore); return $dataStore; } throw $e; } }
public function testUnconfiguredGetConnection() { $datastore = new QlDataStore(); $this->setExpectedException('\\Packaged\\Dal\\Exceptions\\DalResolver\\ConnectionNotFoundException'); $datastore->getConnection(); }