I want to get a specific column from a user table in yii2 using the active entry below my code
$model = User::findOne(['id' => 1]);
this will return the entire column from the table with the user id equal to 1, but suppose I just want to get only the username and email address from this column. How can I write a query with an active record, I tried the code below, but it will not work .. '
$model = User::find('username','email')->where('id'=1)
source share