Hi there,

Could someone help me figure out what I'm doing wrong here?  I have a
Post model that acts as a tree.  In my model I have

var $belongsTo = array(
      'Parent' => array(
        'className' => 'Post',
        'foreignKey' => 'parent_id'
      )
);

var $hasMany = array(
      'Child' => array(
        'className' => 'Post',
        'foreignKey' => 'parent_id',
        'dependent' => false,
        'conditions' => array('Child.type <>' => 'Comment')
      )
);

And this works fine pulling out the child posts for a given Post.  You
can see above I'm using a condition to get only child posts of type =
Comment.  When I want to pull out the post of type 'Comment' I change
the above code to:

var $hasMany = array(
      'Child' => array(
        'className' => 'Post',
        'foreignKey' => 'parent_id',
        'dependent' => false,
        'conditions' => array('Child.type <>' => 'Comment')
      ),
      'Comment' => array(
        'classname' => 'Post',
        'foreignKey' => 'parent_id',
        'dependant' => true,
        'conditions' => array('Comment.type' => 'Comment')
      )
);

This however breaks my application with a missing database table
error.

Any ideas, please?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to