D
D
darknet372017-06-07 10:20:38
Yii
darknet37, 2017-06-07 10:20:38

How to get values ​​of all fields from DB in related tables?

Please tell me how to be?
I have a table with products, properties and another table links them.
I want to do as in the video from Maxim Timofeev about the Select2 extension.
In the video he selects via ArrayHelper:map i.e. key and value.
Everything would be fine, but I need this drop-down list to contain not just "id" and "name", but also the value of other fields. How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-06-07
@darknet37

If I understand the problem correctly, then:

ArrayHelper::map($array, 'id', function ($element){
    return $element['name']. ' ' . $element['paramName'];
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question