On May 7, 11:31 am, Donald Tyler <chekot...@gmail.com> wrote:
> You shouldn't be persisting the Form itself, you should persist an Entity.
>
> You need to bind the Form to the request, and pass it the Entity that you
> want the Form values to be applied to. Read here for step by step
> instructions:
>
> http://symfony.com/doc/current/book/forms.html

Thanks a lot Donald. My mistake was that since $topicform is validated
through the isValid() method, I thought that form contained data which
I could persist directly.

I have since changed the "if ($topicform->isValid())" method to:

   if ($topicform->isValid()) {

                $topic = new Topic();
                $arrayvar =  $request->get('arraykey');


                $topicgetvar = $arrayvar['Topic'];


                $topic->setTopic($topicgetvar);


                $dm = $this-
>get('doctrine.odm.mongodb.document_manager');
                $dm->persist($topic);
                $dm->flush();

                return $this->redirect($this-
>generateUrl('_admin_secured_home'));

}

Everything seems to be working correctly now.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to