Saturday, October 4, 2008

Re: How to save extra field in join table in HATBM Cake1.2

Hi Andre,

In the HABTM relationship definition you can define an attribute
'with' where you can specify which model acts as the HABTM model (in
your case posts_tags). Then you can create the posts_tags model which
gets saved with the additional fields.
I have not experimented with it but I saw some articles/posts about
this a few days ago (a quick search did not turn up any useful links
so you'll have to search for yourself).
Hope this helps (or at least a little ;)).

Good luck!

GrandiJoos

On 4 okt, 18:28, Andre <andre_susan...@yahoo.com> wrote:
> Hi all,
> I saw "Storing additional data on join table"https://trac.cakephp.org/ticket/828.
> Having, two tables associated with HABTM: tags, posts, posts_tags
> posts_tags{ post_id,tag_id,weight }
>
> Can anyone help me showing how to use it, in the Post 's add or Post
> 's edit view in to populate "weight" field in posts_tags.weight
> column?
>
> I am thinking to use Checkbox options to select related
> posts_tags.weight, And input text to enter weight.
>
> I've been struggling with this issue for few weeks with HABTM where
> the join table record is deleted and reinserted everytime, thus the
> posts_tags.weight column were never saved?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: