In case you haven't seen it, I've replied to your post on
cakephpforum.net:

http://www.cakephpforum.net/index.php?showtopic=155&st=0&#entry953

Long story short: you can't have the same Alias (key) for 2 different
associations. Change one or both keys.

On Jan 25, 10:47 am, dandreta <[EMAIL PROTECTED]> wrote:
> On 24 ene, 14:13, dandreta <[EMAIL PROTECTED]> wrote:
>
> > Hi!
> > I have been verifying it and I have a problem with the relations,
> > concretly with one:
> > 1 Project - N Persons
> > N Persons - N Projects
> > I have two different relations between the same models (Project and
> > Person). I explain it:
> > A project can be realized by several persons, but a person only can
> > realize an only one project (relation 1-N).
> > On the other hand, before realizing a project, a list of persons are
> > short-listed and in this preselection the same person can be related
> > to several projects (relation N-N).
>
> > Therefore I have:
> > Project hasMany Person---------------------------Person belongsTo
> > Project
> > Project hasAndBelongsToMany Person-------Person hasAndBelongsToMany
> > Project
> > And in Project model I have it in this way:
>
> > var $hasMany = array(
> >                         'Person' => array('className' => 'Person',
>
> > 'foreignKey' => 'project_id'
> >         );
>
> >         var $hasAndBelongsToMany = array(
> >                         'Person' => array('className' => 'Person',
> >                                                 'joinTable' =>
> > 'persons_projects',
> >                                                 'foreignKey' =>
> > 'project_id',
>
> > 'associationForeignKey' => 'person_id'
> >         );
>
> > If I remove one of these relations, the error does not appear.
>
> > How can I solve it?
> > Any suggestion?
> > Thanks and regards
>
> > On 23 ene, 23:36, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > There is a problem in one of your related model relations or relations
> > > of the related models. Check about 'fields' options and maybe
> > > className etc ...
>
> > > A way to search would be to remove the relation on this model one
> > > after the other, until error disappear ..That will give you which
> > > model to focus one.
> > > Think also about clearing cache (models / persistent) if any.
>
> > > hth
>
> > > On Jan 23, 8:18 pm, dandreta <[EMAIL PROTECTED]> wrote:
>
> > > > Hi!!
> > > > I have index function in my controller of the following form:
>
> > > > function index() {
> > > >                 $this->Proyecto->recursive = 2;
> > > >                 $this->set('proyectos', $this->paginate());
> > > >         }
>
> > > > And all of the projects appear correctly in the index view with their
> > > > fields and for each project the information of other related tables.
> > > > The problem is that this error appears:
>
> > > > Notice (8): Undefined offset:  0 [CORE/cake/libs/model/datasources/
> > > > dbo_source.php, line 882]
>
> > > > I have observed that it seems to be because of recursive attribute,
> > > > since if I put it = 0, the error does not appear, but the information
> > > > of the related tables does not appear.
> > > > Also If I put it =1 the error appears.
>
> > > > How can I solve this error?
> > > > Any suggestion?
> > > > Thanks and regards
--~--~---------~--~----~------------~-------~--~----~
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