Hello,
I’ve spent a lot of time trying with forms in Symfony2, but I don´t got results. I want to have the typical system which let me Edit, Create and Delete a record from a database. I’ve defined: 1) MyBundle/Entity/articles.php: namespace My\BackBundle\Entity; /** * @orm:Entity */ class Articles { /** * @orm:GeneratedValue * @orm:Id * @orm:Column(type="integer") */ private $id; /** * @orm:Column(type="integer") */ private $name; ….. getters and setters 2) MyBundle/Resources/views/Articles/edit.html.twig <form method="post" action="{{ path("back_articles_edit", {"id": form.id->getData()}) }}"> {{ form_field(form) }} <input type="submit" value="Guardar" /> </form> 3) MyBundle/Controller/ArticlesController.php public function editAction($id) { $form = ArticlesForm::create($this->get('form.context'), 'articles'); $request = $this->get('request'); $metodo=$request->getMethod(); switch ($metodo) { case 'GET': $em = $this->get('doctrine.orm.entity_manager'); $article = $em->find('MyBackBundle:Articles, $id); if (!$article) { throw new NotFoundHttpException("Article not found."); } // I think, here I should bind the data retrieved to the form. But How???? return array('form'=>$form); break; case 'POST': // Here, I should get the submitted data, validate and save to the database. How???? break; } } I’ve made a lot of change and I’m so tired. Any answer will be welcome. Thanks Un saludo Sergio Pérez Informática ALBATRONIC, SL Av. Blas Otero, 10 Local 1 18200 Maracena - Granada Tlf: +34 958410343 Fax: +34 958421504 www.albatronic.com -- 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