In the action that processes the submission you just create two new
objects, one for ForumThreads and the other for ForumPosts and save
each individually. My example below is in Propel:

$forum_thread = new ForumThreads();
$forum_thread->setSubject($request->getParameter('subject'));
$forum_thread->save();

$forum_post = new ForumPost();
$forum_post->setMessage($request->getParameter('message'));
$forum_post->setForumsThreadsId($forum_thread->getId());
$forum_post->save();

Please remember to replace my $request->getParameter with the
applicable variable for your bound form however.

On Mon, Feb 8, 2010 at 1:25 PM, Martin Henits
<[email protected]> wrote:
> Hi,
>
> I'm new to symfony and am trying to learn it.
> I am trying to develop a new module (something like a forum). in a
> very simple form, this module works with 2 database tables:
> "forum_threads" and "forum_posts".
>
> First, I think that I should not develop 2 different modules, because
> forum sounds like one module in my mind. (am I right?)
>
> the "create new thread" form has 2 fields: "subject" and "message".
> when someone clicks on the save button, the "subject" field should be
> saved in the "forum_thread" table and the "message" field should be
> saved in the "forum_posts" table. Any clue for doing this?
>
> Any suggestion is highly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "symfony users" 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/symfony-users?hl=en.
>
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en.

Reply via email to