I think creating a model is the way to go.
On Mon, Mar 31, 2008 at 6:04 AM, michaaaa <[EMAIL PROTECTED]> wrote:
>
> Hello bakers!
>
> First: I think the new "with" attribute in HABTM definitions is great.
> I started a new project including a User and a Game model with a HABTM
> relationship. The join table is "games_users" and contains three
> fields: "game_id", "user_id" and the additional field "last_played".
>
> Users and Games are not added or updated using a form but parsing an
> XML file. Associations are created by setting $this->data['Game']
> ['Game'] = array('GAME_ID_1', 'GAME_ID_2'); and then calling $this-
> >User->save();. So far so good.
>
> But what is the best way to update the "last_played" field in the join
> table? I also asked this question in the IRC channel yesterday and got
> the advice to create a model. But what's the whole point of being able
> to fetch additional join table fields by setting the "with" attribute
> in the HABTM definition but not being able to update these fields
> without creating a model?
>
> Of course I could always write a custom query to update this data but
> it's is a really ugly solution and I want to stay as clean as
> possible, if you know what I mean. ;)
>
> Is there something I overlooked or do I really have to create a model
> for the join table?
>
> Thanks for reading, I'd appreciate any help. Have a nice day. :)
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---