Kohana 3.2 relationship - Joins -


i have current design in mysql :

table filesubject enter image description here

is there way in kohana set relationship in way if make

orm::factory('filesubject')->where('file_id','=',$file->id)->find_all()->as_array());

that joins other tables ?

i'm not sure question. automatically join models, first setup relationships ($_belongs_to etc) , at:

in model:

orm property: $_load_with. eg: protected $_load_with= array(model1, model2, etc) 

or @ run time:

orm method: with(). eg: orm::factory('filesubject')->with('model')->with('model2')->find_all() 

i don't think as_array() function pulls in joined data though. once it's performing join you'd need overwrite as_array (or write own function) output nested key/pair values joined properties.


Comments