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') or orderBy(['neighbourhood.name' => SORT_DESC]) - InDevX
  • I wrote in the example, does not work like this - SOFQ3
  • Show how you use the request, then - InDevX
  • LinkPage :: find () -> joinWith ('subways') -> joinWith (' areas') -> joinWith ('addresses') -> joinWith (' landmark ') -> orderBy (' subway.name, neighborhood.name ') -> all (); - SOFQ3 pm

0