DbObjectWithSettings: fix for unstored objects

This commit is contained in:
Thomas Gelf 2018-07-13 10:56:51 +02:00
parent bdb1ec8473
commit 31b2326e1e
1 changed files with 6 additions and 1 deletions

View File

@ -139,10 +139,15 @@ abstract class DbObjectWithSettings extends DbObject
protected function fetchSettingsFromDb()
{
$db = $this->getDb();
$id = $this->get('id');
if (! $id) {
return [];
}
return $db->fetchPairs(
$db->select()
->from($this->settingsTable, ['setting_name', 'setting_value'])
->where($this->settingsRemoteId . ' = ?', $this->get('id'))
->where($this->settingsRemoteId . ' = ?', $id)
->order('setting_name')
);
}