from(Qs_Db::getPair('TrainingLanguage'), ['title']); $select->where('id = ?', $languageId); $select->limit(1); return Qs_Db::getInstance()->fetchOne($select); } public static function get4Select() { $select = Qs_Db::getSelect(); $select->from(Qs_Db::getPair('TrainingLanguage'), ['id', 'title']); $select->order('sorter'); return Qs_Db::getInstance()->fetchPairs($select); } public static function getTrainingLanguages4Select() { $check = Qs_Db::getSelect(); $check->from(Qs_Db::getPair('Test'), ['found' => 'id']); $check->where('Test.languageId = TrainingLanguage.id'); $check->where('Test.enabled = "y"'); $check->where(TrainingModel::getTestSlideExists('Test.id')); $check->limit(1); $select = Qs_Db::getSelect(); $select->from(Qs_Db::getPair('TrainingLanguage'), ['id', 'title']); $select->where('EXISTS (' . $check . ')'); $select->order('sorter'); return Qs_Db::getInstance()->fetchPairs($select); } }