/** * Return array for User Select2 with current user selected * @return array */ public function getUsersSelect2($userid, $username) { $sql = 'SELECT id,username FROM {{%user}} WHERE id != ' . $userid; $users = User::findBySql($sql)->asArray()->all(); $array[$userid] = ucwords($username); foreach ($users as $user) { $array[$user['id']] = ucwords($user['username']); } return $array; }