public function actionCustomerList($q = null) { $query = new Query(); $query->distinct('customer_fullname')->select('customer_fullname, customer_company, customer_phone, customer_email')->from('{{%ticket}}')->where('customer_fullname LIKE "%' . $q . '%"')->orderBy('customer_fullname'); $command = $query->createCommand(); $data = $command->queryAll(); echo Json::encode($data); // $out = []; // foreach ($data as $d) { // $out[] = $d['name']; // } // echo Json::encode($out); }