Have a connection
return $this->hasOne(Neighbourhood::className(), ['slug' => 'url'])->onCondition(['neighbourhood.city_id' => $this->city_id]); Which then through joinWith is connected. How to make sorting in this regard?
return $this->hasOne(Neighbourhood::className(), ['slug' => 'url'])->onCondition(['neighbourhood.city_id' => $this->city_id])->orderBy('neighbourhood.name'); does not work if specified later in the connected request does not work either. If you remove onCondition, the sorting starts.
orderBy('neighbourhood.name')=>orderBy('neighbourhood.name DESC')ororderBy(['neighbourhood.name' => SORT_DESC])- InDevX