Hi,

I'm trying to do a join that does not depend on a foreign key, but
uses other clauses that I provide via the conditions attribute.
Unfortunately I can't seem to get CakePHP to stop adding the
foreignKey, even when I set it to null, an empty string or false.

Here's the basic idea of what I'm trying to do.  I have a news item
that is tied to a tree structure (using the tree behaviour), I want to
bring back information about the parent (if it's of a certain type).

var $belongsTo = array(
  'Structure' => array(
    'className' => 'Structure',
    'foreignKey' => 'structure_id'
  ),
  'parent' => array(
    'className' => 'Structure',
    'foreignKey' => false,
    'conditions' => 'parent.type_id = 1 AND parent.left_id <
Structure.left_id AND parent.right_id > Structure.right_id'
  )
);

The query would be perfect if it wasn't for the magically appearing
"AND `News`.`parent_id` = `parent`.`id`" on the end of the join
clause.  Anyone have any ideas?

Thanks,
Dave

--~--~---------~--~----~------------~-------~--~----~
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