Forms 名为isSubmitted的未定义方法?西蒙尼

Forms 名为isSubmitted的未定义方法?西蒙尼,forms,symfony,Forms,Symfony,所以我以前做过,没有错误,可能是symfony2,现在是symfony3,可能不是一个相关的问题,只是说。我怎样才能解决这个问题 错误: Attempted to call an undefined method named "isSubmitted" of class "Symfony\Component\Form\FormView". 500 Internal Server Error - UndefinedMethodException 代码: namespace AppBundle\C

所以我以前做过,没有错误,可能是symfony2,现在是symfony3,可能不是一个相关的问题,只是说。我怎样才能解决这个问题

错误:

Attempted to call an undefined method named "isSubmitted" of class "Symfony\Component\Form\FormView".
500 Internal Server Error - UndefinedMethodException
代码:
namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\AbstractType;
use AppBundle\Entity\Submission;
use Symfony\Component\Form\Extension\Core\Type\TextType;


use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\Response;


use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;


class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {

        $variables = array();

        $submission = new Submission();
        $form = $this->createFormBuilder($submission)
            ->add('name', TextType::class)
            ->add('phonenumber', TextType::class)
            ->add('email', TextType::class)
            ->add('postal', TextType::class)
            ->add('housing', TextType::class)
            ->add('project', TextType::class)
            ->add('motivation', TextType::class)
            ->add('save', SubmitType::class, array('label' => 'Create submission'))
            ->getForm()->createView();


        var_dump($form->isSubmitted());
        die();
        if ($form->isSubmitted() && $form->isValid()) {
            print_r("yeay");
            die();
            $em = $this->getDoctrine()->getManager();
            $em->persist($submission);
            $em->flush();
        }


            // $variables['form'] = $form;
        // replace this example code with whatever you need
        return $this->render('AppBundle::main.html.twig', [
            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
            'form' => $form,
        ]);
    }
}

您在表单视图而不是表单上调用了
issubmitt()
。对象没有此方法

创建如下表单:

$form=$this->createFormBuilder($submission)
->添加('name',TextType::class)
->添加('phonenumber',TextType::class)
// ...
->getForm();
在将视图传递给模板之前创建视图:

return$this->render('AppBundle::main.html.twig'[
'form'=>$form->createView(),
]);

您在表单视图而不是表单上调用了
issubmitt()
。对象没有此方法

创建如下表单:

$form=$this->createFormBuilder($submission)
->添加('name',TextType::class)
->添加('phonenumber',TextType::class)
// ...
->getForm();
在将视图传递给模板之前创建视图:

return$this->render('AppBundle::main.html.twig'[
'form'=>$form->createView(),
]);

啊,我明白了!谢谢:)2分钟:)顺便说一句,现在当我发布它的罚款,但isSubmitted是假的,你看到我的代码中有更多的错误吗?堆栈溢出不是你的个人调试服务;)好吧,我们都有好日子和坏日子,今天不是很好,有时我没有我的橡皮鸭和我在一起;p@Jakub Zalas那我该去哪里?啊,我明白了!谢谢:)2分钟:)顺便说一句,现在当我发布它的罚款,但isSubmitted是假的,你看到我的代码中有更多的错误吗?堆栈溢出不是你的个人调试服务;)好吧,我们都有好日子和坏日子,今天不是很好,有时我没有我的橡皮鸭和我在一起;p@Jakub Zalas那我该去哪里?