Thank you! That fixed my problem perfectly!

AD7six wrote:
> Hi Brian,
>
> You can´t create 2 associations with the same name. You can't say a
> user HasOne Venue and User HABTM Venue - if you don´t give you
> associations unique names the data for both will get mixed together
> (with confusing results as you have seen).
>
> Let me clarify what that means before you say "but I need those
> associations" ;)
>
> Try something like this:
> <?php
> class User extends AppModel
> {
>     var $name = 'User';
>
>     var $hasOne = array('MainFan' => // Changed
>                         array('className'    => 'Fan',
>                               'conditions'   => '',
>                               'order'        => '',
>                               'dependent'    =>  true,
>                               'foreignKey'   => 'user_id'
>                         ),
>                         'MainArtist' => // Changed
>                         array('className'    => 'Artist',
>                               'conditions'   => '',
>                               'order'        => '',
>                               'dependent'    =>  true,
>                               'foreignKey'   => 'user_id'
>                         ),
>                         'MainVenue' => // Changed
>                         array('className'    => 'Venue',
>                               'conditions'   => '',
>                               'order'        => '',
>                               'dependent'    =>  true,
>                               'foreignKey'   => 'user_id'
>                         ),
>                         'MainPromoter' => // Changed
>                         array('className'    => 'Promoter',
>                               'conditions'   => '',
>                               'order'        => '',
>                               'dependent'    =>  true,
>                               'foreignKey'   => 'user_id'
>                         ),
>                   );
>     var $hasAndBelongsToMany =
> array('Fan','Artist','Venue','Promoter'); // unchanged
> }
>
> If the hasOne is to specify some special relationship, I think that in
> 1.2 you have/will have the possibility to add fields to your join table
> such that you could then have only a HABTM with one of the defined
> relationships having the type "Main" (or whatever is the actual
> meaining of the hasOne as defined here).
>
> Rather than dribble on, after renaming your associations - does that
> work?
>
> HTH,
>
> AD7six
> PS. this is all based upon looking at your debug data and glancing at
> the source - so it could be wrong.
>
>
> >
>
>
>   


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

Reply via email to