N
N
Nikita Ronzin2017-02-21 12:28:57
MySQL
Nikita Ronzin, 2017-02-21 12:28:57

Is it possible to display data from an unrelated table?

Is it possible to display data from an unrelated table together? There are two modules, their tables are not related, but I need to output data from another model through one model. How can I do that ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Ronzin, 2017-04-11
@Ababinili

array(
            'name' => 'street',
            'value' => function ($data) {
                $output = "";
                if ($data->street instanceof Street) {
                    $output .= $data->street->Street;
                    if ($data->street->town instanceof Town) {
                        $output .= "," . $data->street->town->Town;
                    }
                }
                return $output;
            },
        ),

as an acceptable option

A
Anton, 2017-02-21
@Eridani

Why don't you use JOIN?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question