Goes to show I should read more carefully :)
I guess the title of the post made me jump the gun...

You say "an user has 2 of the same webpage_type"

Does it mean that in your join table you have something like: ?
user_id | web_page_type_id
-----------------------------------------
    7      |          6
    7      |          6

On Oct 3, 6:27 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Well, assuming the Docs are correct (and I understand it properly),
> that should only apply to updates ("If true (default value) cake will
> first delete existing relationship records in the foreign keys table
> before inserting new ones, when updating a record. So existing
> associations need to be passed again when updating").
>
> However, in my circumstance, I'm just retrieving information ...
>
> Debug SQL shows the (as expected) query of getting all webpages &
> types based on the user_id, and it retrieves all the information
> that's needed; however, by the time I get to the view (where I have a
> `pr()`), I've magically lost one of 'em - well, actually, any
> subsequent webpage_type record that has the same id.
>
> Conventions: Yeah, I know those were just there, left over from
> scaffolding, so figured no harm in leaving 'em ...
>
> On Oct 3, 3:19 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Do you know what 'unique'=>true does?
>
> > Btw, there really isn't any need to define default values for your
> > associations if you follow the conventions.
>
> > On Oct 3, 6:10 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > Ok, so here's the scenario ...
>
> > > A user can have multiple webpages in their account, and when they set
> > > them up, they must choose the type (ex: blog, gallery, etc). So User
> > > HABTM webpage_type ... where users_webpage_types has additional fields
> > > for URL, title, etc.
>
> > > The thing I'm running into is upon retrieving: If an user has 2 of the
> > > same webpage_type, it performs the SQL to get 'em all, but once it's
> > > done it's magic, it only has the first record. I'm assuming this is
> > > due to the occurrence of the same webpage_type_id, but still lost ...
>
> > > User::
>
> > >         var $hasAndBelongsToMany = array(
> > >                         'WebpageType' => array('className' => 
> > > 'WebpageType',
> > >                                                 'joinTable' => 
> > > 'users_webpage_types',
> > >                                                 'foreignKey' => 
> > > 'userr_id',
> > >                                                 'associationForeignKey' 
> > > => 'webpage_type_id',
> > >                                                 'with' => 
> > > 'UsersWebpageType',
> > >                                                 'unique' => true,
> > >                         ),
>
> > > WebpageType::
>
> > >         var $hasAndBelongsToMany = array(
> > >                         'User' => array('className' => 'User',
> > >                                                 'joinTable' => 
> > > 'users_webpage_types',
> > >                                                 'foreignKey' => 
> > > 'webpage_type_id',
> > >                                                 'associationForeignKey' 
> > > => 'user_id',
> > >                                                 'with' => 
> > > 'UsersWebpageType',
> > >                                                 'unique' => true,
>
> > > UsersWebpageType::
>
> > >         var $belongsTo = array(
> > >                         'User' => array('className' => 'User',
> > >                                                                 
> > > 'foreignKey' => 'user_id',
> > >                                                                 
> > > 'conditions' => '',
> > >                                                                 'fields' 
> > > => '',
> > >                                                                 'order' 
> > > => ''
> > >                         ),
> > >                         'WebpageType' => array('className' => 
> > > 'WebpageType',
> > >                                                                 
> > > 'foreignKey' => 'webpage_type_id',
> > >                                                                 
> > > 'conditions' => '',
> > >                                                                 'fields' 
> > > => '',
> > >                                                                 'order' 
> > > => ''
> > >                         )
> > >         );
>
> > > Seriously confused ....
>
> > > I've searched the group, and came up empty handed - probably due to
> > > diff keywords.
>
> > > Cheers.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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