Hello why ($criteria -> select = 'id as id2') doesn't work?


(ganbatte) #1

I want to use $criteris->join. But i can’t give all column, and renamed and new column from join, and as. I show example my code. Help my please.
class TestController extends Controller
{
public function actionIndex ()
{
$test = new Test;
$criteria = new CDbCriteria;
$criteria->select = [‘id as ads’];
$result = $test->find($criteria);

       var_dump($result);
}
}

it's result
["_attributes":"CActiveRecord":private]=>
  array(0) {
  }