Use Icinga\Data\Db\DbConnection instead of Zend_Db_Select directly

fixes #6218
This commit is contained in:
Johannes Meyer 2014-07-09 10:41:54 +02:00
parent 329b1cf960
commit 0fc2604af3

View File

@ -5,7 +5,6 @@
namespace Icinga\User\Preferences\Store; namespace Icinga\User\Preferences\Store;
use Exception; use Exception;
use Zend_Db_Select;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Exception\NotWritableError; use Icinga\Exception\NotWritableError;
use Icinga\User\Preferences; use Icinga\User\Preferences;
@ -73,10 +72,10 @@ class DbStore extends PreferencesStore
public function load() public function load()
{ {
try { try {
$select = new Zend_Db_Select($this->getStoreConfig()->connection->getConnection()); $select = $this->getStoreConfig()->connection->select();
$result = $select->from($this->table, array(self::COLUMN_PREFERENCE, self::COLUMN_VALUE)) $result = $select->from($this->table, array(self::COLUMN_PREFERENCE, self::COLUMN_VALUE))
->where(self::COLUMN_USERNAME . ' = ?', $this->getUser()->getUsername()) ->where(self::COLUMN_USERNAME . ' = ?', $this->getUser()->getUsername())
->query()->fetchAll(); ->fetchAll();
} catch (Exception $e) { } catch (Exception $e) {
throw new NotReadableError( throw new NotReadableError(
'Cannot fetch preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e 'Cannot fetch preferences for user ' . $this->getUser()->getUsername() . ' from database', 0, $e