I have a user practice model and a car model. In the occupation model, the auto field is associated with the id in the auto model. In order to make it easier for me to select these cars during class output, I wrote this in the class model:
public function getAuto() { return $this->hasOne(Autos::className(), ['id' => 'auto']); } And when outputting I use this:
var_dump($model->auto) But nothing is displayed. Am I doing something wrong? Sorry if I explained poorly