Ar Corrupting Result

I have two tables: ‘section’ and ‘section_lang’.

The table ‘section_lang’ has a column with the value ‘Nice Section’.

This is my query:




    $sections = self::find()->select(['section.id', 'section_lang.section_name'])->innerJoin('section_lang', 'section_lang.section_id = section.id')->where('section_lang.language_id = 1)->orderBy('section_lang.section_name')->all();



The ‘section_name’ result returned is: ‘NicNBSection’.

What gives?

No replies? Ok, should I report this as a bug?

AR will not allow this type of query if there is a relation - the result gets corrupted (somehow) as above.

This works (kinda):




    $sections = self::find()->all();


    $section_array = array();


    foreach($sections as $val) {

        $section_array[$val->id] = $val->sectionLang->section_name;

    }


    return $section_array;



The only problem is, I want a join query so I can order the result by section_name…

DAO it is sigh