S
S
Sergey Erin2019-11-14 10:01:17
Yii
Sergey Erin, 2019-11-14 10:01:17

How to write data from a database to an array using Yii2?

Hello, it is not possible to write data from a selection of 2 related tables Language_description and language into an array. only the name parameter is written to the array

$languages = LanguageDescription::find()
    ->select([
        'name',
        'code'
    ])
    ->innerJoin('language', 'language.id = language_description.language_id')
    ->where(['LIKE', 'code', $query])
    ->orwhere(['LIKE', 'name', $query])
    ->all();

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2019-11-14
@artalexs

->asArray();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question