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