I have a table containing fields
id, vehicle_id, vehicle_rating_type, vehicle_rating, rating_time
I want to get values based in vehicle_id, so I fired query
$id = Yii::$app->getRequest()->getQueryParam('id');
$data = VehicleRating::find()->where(['vehicle_id' => $id]);
Now when I prints $data array in view file using print_r function I get following result.
yii\db\ActiveQuery Object (
[sql] =>
[on] =>
[joinWith] =>
[select] =>
[selectOption] =>
[distinct] =>
[from] =>
[groupBy] =>
[join] =>
[having] =>
[union] =>
[params] => Array ( )
[_events:yii\base\Component:private] => Array ( )
[_behaviors:yii\base\Component:private] => Array ( )
[where] => Array (
[vehicle_id] => 1
)
[limit] =>
[offset] =>
[orderBy] =>
[indexBy] =>
[modelClass] => backend\models\VehicleRating
[with] =>
[asArray] =>
[multiple] =>
[primaryModel] =>
[link] =>
[via] =>
[inverseOf] =>
)
How to retrive values from this array to show in view file? Say I want to say vehicle_id and vehicle_rating. How to print it?