Sunday, October 4, 2009

Re: Field Naming conventions and hasmany records

You'll have to save the topic first and then fetch it's id. From the
cookbook: "If neither of the associated model records exists in the
system yet (for example, you want to save a new User and their related
Profile records at the same time), you'll need to first save the
primary, or parent model." http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

On Oct 5, 6:27 am, "#2Will" <willjbar...@gmail.com> wrote:
> Hi,
>
> I want to add a "comment" to a new 'Topic' when adding topics. Sort of
> like a first post of a new forum category.
>
> To do this, i was hoping that adding a field like this:
>
> echo $form->input('ForumComment.comment');
>
> to my form would create a text area and add the comment in.
>
> instead it makes a text input field (which makes me think cake hasn't
> guessed what im on about, since the comment field is a text type. )
> and no comment is saved.
>
> Can Cake do this automagicaly, or should i be writing the code to
> fetch the last topic id, and insert the comment after the topic
> insert?
>
> Thanks for any guidence
>
> Will
--~--~---------~--~----~------------~-------~--~----~
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: