where('1 = 1'); if (!empty($where['section'])) { $query->andWhere('section = :section:', ['section' => $where['section']]); } return $query->execute(); } /** * @param string $section * @param string $itemKey * @return SettingModel|Model|bool */ public function findItem($section, $itemKey) { return SettingModel::findFirst([ 'conditions' => 'section = :section: AND item_key = :item_key:', 'bind' => ['section' => $section, 'item_key' => $itemKey], ]); } /** * @param string $section * @return ResultsetInterface|Resultset|SettingModel[] */ public function findBySection($section) { $query = SettingModel::query(); $query->where('section = :section:', ['section' => $section]); return $query->execute(); } }