Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/02/2014, 13:47
Avatar de koloinotzente
koloinotzente
 
Fecha de Ingreso: febrero-2012
Ubicación: Panama
Mensajes: 4
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: Symfony 2.4.1:This form should not contain extra fields

Si Ya habia googleado el problema, era puntual en mi controlador: se debia llamar al metodo createcreateform en vez de createform.

Código:
    public function createAction()
    {
        $entity  = new User();
        $request = $this->getRequest();
        //$form    = $this->createForm(new UserType(), $entity);
         // --------------
        $form = $this->createCreateForm($entity);
        $form->submit($request);
        
      

/*
*/
        if ($form->isValid()) {
            //establecemos la contraseña: --------------------------
            $this->setSecurePassword($entity);

            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('admin_user_show', array('id' => $entity->getId())));

        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView()
        );
    }