How to return 1 record in Active Record

Hi, I tried this


  $user = User::find()->where(['username' => $username])->one();

It only return username column value ‘Fred’.

How to return it’s row ?

example


26    Fred   Matt   30    China

Thank you in advance.

Not really sure what you want but here are some examples that may help:




// this gets you a user Model object:

$user = User::find()->where(['username' => $username])->one();

// this will print the user name:

echo $user->username;

// this gets you all attributes:

print_r($user->attributes);



@CeBe,Thank you it helps :)