there is such a request
$top_cats = ModArendaTree::find()->with('adscount')->where(['active' => 1])->andWhere(['parent_id' => 0])->orderBy(['popular' => SORT_DESC, 'sort' => SORT_DESC])->all(); determined the relationship in the model
public function getAdscount(){ return $this->hasMany(CatsForAds2::className(),['ad_id'=>'id'])->count(); } however, it displays an error that there is no such connection.
app\modules\Tree\models\ModArendaTree has no relation named "adscount". но есть в связи убираю "->count()" то все отлично работает... Почему так?