public function getCategoriesSelect2($id) { $sql = 'SELECT id,name FROM {{%article_categories}} WHERE published = 1 AND id !=' . $id; $categories = Categories::findBySql($sql)->asArray()->all(); $array[0] = \Yii::t('articles.message', 'No Category'); foreach ($categories as $category) { $array[$category['id']] = $category['name']; } return $array; }