I got this to work and am posting here in case anybody has the same
issue in the future.

I noticed that Model::findAll defines a $queryData array with a
'joins' element, although it always sets this element to an empty
array(). So I added a beforeFind() filter in my model that simply adds
the proper info to $queryData['joins'], and also a flag in the model
that lets me turn this behavior on and off from the controller.

function beforeFind($queryData) {
  if ($this->addJoin) {
    $queryData['joins'] = array(
                array(
                  'table' => 'fully_qualified_related_table_name',
                  'alias' => 'RelatedTableAlias',
                  'conditions' => array(
                    'RelatedTableAlias.column_name =
MasterTableAlias.column_name'
                  )
                )
              );
  }

  return $queryData;
}


It seems to me this could be easily avoided if a $joins param array
could be added to the call list for Model::findAll, but in the
meantime this is not too difficult of a workaround.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to