Hello, the problem is what I'm trying to do to

Pages::find()->all(); 

Two bases were displayed, common and language.
For some reason it does not work correctly:

 public function all($db = null) { $this->select(['pages.*', '`pages_lang`.title']); $this->leftJoin('pages_lang', 'pages.id = pages_lang.page_id AND pages_lang.lang_id = '.Lang::getCurrent()['id']); return parent::all($db); } 

Only data from pages is displayed ....

    1 answer 1

    It is better to describe the relationship between the Pages model and the model, for example, Languages

     public function Language() { return $this->hasOne(Languages::className(), ['id' => 'lang_id']); // если предполагается связь один ко многим, то используем hasMany // return $this->hasMany(Languages::className(), ['id' => 'lang_id']); } 

    and then just refer to the Languages ​​model as the Pages property

     $page = Pages::findOne(1); var_dump($page->language->attributes);