Question

I can't seem to select data from multiple tables with Kohana ORM.

When I do:

$obj = orm::factory('a')
         ->join('b')
         ->on('a.b_id','=','b.id')
         ->select ('b.*','a.*')
         ->find_all();

the only variables available in $obj are from table a.

Was it helpful?

Solution

You can't overwrite table a variables with table b ones as you're instancing the Model_A, not Model_B ( ORM::factory('a') ).

When you do this, orm will automatically append select($this->_table_name.*) after all other selects so the previous ones (their keys) will be overwritten.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top