After a *lot* of trial and error, I've finally fixed this!

What was happening was this:

> App::import('Model', 'Person');

Was, through a long winded bunch of entity-relationship type
associations, making CakePHP read in my Categories model.

> $this->PersonTemp = new Person(); # This conflicts with webpages'
> recursion, but not categories' recursion

So what was happening was calling in the person model was causing the
Webpages model and the Categories model to conflict *with each other*,
as both use themselves as parents and children.

So changing the models like this fixes it:

Class Category extends AppModel
{
  var $name = 'Category';

  var $belongsTo = array(
    'ParentCategory' => array( // Calling it 'Parent' conflicts with
webpages
      'className' => 'Category',
      'foreignKey' => 'parent_id'
    )
  );

  var $hasMany = array(
    'ChildCategory' => array( // Calling it 'Child' conflicts with
webpages
      'className' => 'Category',
      'foreignKey' => 'parent_id'
    )
  );
}

Class Webpage extends AppModel
{
  var $name = 'Webpage';

  var $belongsTo = array(
    'ParentWebpage' => array( // Calling it 'Parent' conflicts with
categories
      'className' => 'Webpage',
      'foreignKey' => 'parent_id'
    )
  );

  var $hasMany = array(
    'ChildWebpage' => array( // Calling it 'Child' conflicts with
categories
      'className' => 'Webpage',
      'foreignKey' => 'parent_id'
    ),
    'WebpageTranslation' => array(
      'className' => 'WebpageTranslation'
    )
  );
}

I just thought I'd post the fix here for posterity, in case anyone
else ever has the same problem. Make sure that when you make up non-
existant model names, you don't use the same name anywhere else.

Thanks everyone,
Zoe.
--~--~---------~--~----~------------~-------~--~----~
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