In cake PHP, I use containable behavior to join a bunch of tables and make a nice, large array with a bunch of data, like so:
$this->paginate = array(
'contain' => array(
'House' => array(
'Room' => array(
'Chair' => array(),
),
),
'Apartment' => array(),
),
"limit" => $limit,
'conditions' => array('Dwelling.id' => 1),
);
However, this of course returns every column of every table, and what I really want is just the Chair columns, so I do this, adding a "fields" array to a lot of the models:
$this->paginate = array(
'contain' => array(
'House' => array(
'fields' => array("id"),
'Room' => array(
'fields' => array("id"),
'Chair' => array(),
),
),
'Apartment' => array(),
),
"limit" => $limit,
'conditions' => array('Dwelling.id' => 1),
'fields' => array("id"),
);
And then CakePHP says "screw it, I'm just not going to return anything at all besides the Dwelling model." Why would it do this? Upon looking at the actual MYSQL queries, it looks to be querying the database properly for all this; it just doesn't package it all into the resulting array...