How can I self join a model? I want the Topic Model to have many child
topics or be the child of one topic. I am trying to use:

 <?php
class Topic extends AppModel {
        var $name = 'Topic';
        var $hasMany = array(
                'Topic' => array(
                        'className'  => 'Topic',
                        'foreignKey' => 'parent_id'
                )
        );
        var $belongsTo = array(
                'Topic' => array(
                        'className'  => 'Topic',
                        'foreignKey' => 'parent_id'
                )
        );
}
?>

But I get the following error in the index view:

Warning (512): SQL Error: 1066: Not unique table/alias: 'Topic'

Thanks for the help.

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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=.


Reply via email to