Hi,

I don't think I have seen this covered in the groups so far, so I
thought I would ask a question...

First off I am quite new to Cake but not PHP. I have designed a
database, which has one table (pages) that is intended to be
heirarchical. I.e. a page can have one or many sub pages.

So that it can represent the following:

Main Page
  | - Sub Page 1
  | - Sub Page 2
       | -Sub Sub Page 1
  | - Sub Page 3

The table has a foreign key parent_page_id.

And I have defined a $hasMany relationship which is as follows...
        // content_item has many other pages below it
        var $hasMany = array('Page'     =>
                                array('className'   => 'Page',
                                  'conditions'  => '',
                                  'order'       => 'Page.order ASC',
                                  'limit'       => '',
                                  'foreignKey'  => 'parent_page_id',
                                  'dependent'   => false,
                                  'exclusive'   => false,
                                  'finderSql'   => 'Page.parent_page_id
= Page.id'
                         )
                  );

But I tested this using the scaffolding and I get this error lots:
Warning: Invalid argument supplied for foreach() in
/var/www/cake/cake/libs/view/templates/scaffolds/view.thtml on line 179

Does anyone know if I am implementing this wrong? or doesn't cake
support recursive relationships?

Thanks in advance.

James


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

Reply via email to