You need to use a different alias for the associations, and set the
className property to the original class.

class Profile extends AppModel {
  var $belongsTo = array('Country');

  var $hasAndBelongsToMany = array(
    'SearchCountry' => array('className' => 'Country')
  );
}


class Country extends AppModel {
  var $hasMany = array('Profile');

  var $hasAndBelongsToMany = array(
    'SearchCountry' => array('className' => 'Country')
  );
}

On Mar 31, 1:31 pm, Werschinger <[EMAIL PROTECTED]> wrote:
> Dear CakePHP people
>
> I ran into a problem with associations. I have the models Profile and
> Country (n:1). Profile belongsTo Country, and Country hasMany
> Profiles. So, in the table profiles I have a country_id as a foreign
> key.
>
> Now, I'd like a person/user to save countries as search criteria. So,
> I create a HABTM association between Profile and Country and a
> corresponding table.
>
> However, now there is a conflict of associations between Profile and
> Country. What do do?
>
> When reading, it works but when writing with $this->save, the join
> won't work properly.
>
> Any help or idea would be greatly appreciated as this is an urgent
> problem. Many thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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