I think this should work:
<pre>
class Page extends AppModel
{
var $hasMany =
array( 'ChildPages'=>array('className'=>'Page','foreignKey'=>'parend_id'));
var $belongsTo = array('ParentPage'=>array('className'=>'Page',
'foreignKey'=>'parent_id'));
}
</pre>
Don't forget to use recursive option, unbindModel or 'expects' :)
On 14 , 15:22, poncjusz <[EMAIL PROTECTED]> wrote:
> What is the best way to organize Pages on our site? I'm thinking about
> relation between parent pages and their 'child' both contain the same
> information such as their name body and author, but some of them are
> children and some are parents. I think that the best way will be to
> use parent_id field (0 for parent). But I'm not sure is making hasMany
> to this same model is correct or I shoud use HABTM (with pages_pages
> table?). I would like to know how you do it in your applications?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---