Класс «Symfony \ Component \ Form \ Form» не был найден в цепочках имен, заданных цепочкой во время представления формы

Я создаю интерфейс, который позволит людям в офисе редактировать детали конкретных записей. В настоящее время у меня есть такая форма:

view.html.twig

<!-- Modal Windows: Edit Instructor Personal Details --> <div id="editPersonal" style="display:none;"> <div class="modal-head"> <h2>Edit Personal Details For: <font-color="red !important">{{instructor.firstName}} {{instructor.surname}}</font></h2> </div> <div class="modal-body"> <form action="#" method="post" {{ form_enctype(ipde) }} id="editPersonalDetails" class="modaledit"> <table class="modalform-col1"> <tbody> <tr class="hidden"> <th>{{ form_label(ipde.id, 'ID*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.id) }} {{ form_widget(ipde.id, { 'attr': {'class': 'textfield'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.firstName, 'First Name*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.firstName) }} {{ form_widget(ipde.firstName, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.surname, 'Surname*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.surname) }} {{ form_widget(ipde.surname, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.address1, 'Address Line 1*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.address1) }} {{ form_widget(ipde.address1, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.address2, 'Address Line 2', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.address2) }} {{ form_widget(ipde.address2, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.town, 'Town*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.town) }} {{ form_widget(ipde.town, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.county, 'County*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.county) }} {{ form_widget(ipde.county, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.postcode, 'Postcode*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.postcode) }} {{ form_widget(ipde.postcode, { 'attr': {'class': 'text'}}) }} </td> </tr> <tr> <th>{{ form_label(ipde.email, 'Email*', { 'attr': {'class': 'title'} }) }}</th> <td> {{ form_errors(ipde.email) }} {{ form_widget(ipde.email, { 'attr': {'class': 'text'}}) }} </td> </tr> </tbody> </table> </div> <div class="modal-footer"> <div class="modal-placeright"> <a href="#close" rel="modal:close" class="closebutton">Close Without Saving</a> <input type="submit" value="Save Changes" id="savebuttonpr" class="savebutton" /> {{ form_rest(ipde) }} </div> </div> </div> 

И мой контроллер выглядит так:

DefaultController.php

 <?php namespace PCUK\InstructorBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use PCUK\InstructorBundle\Form\IpdeType; use PCUK\InstructorBundle\Form\IrType; use PCUK\InstructorBundle\Form\BaType; use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller { public function viewAction($instructor, Request $request) { // Database connection $insrep = $this->getDoctrine()->getManager(); // Get Instructor from Entity for Form use $instructorQ = $insrep->getRepository('InstructorBundle:MapInstructors')->find($instructor); // Get Shared Branches from Entity for Form use $instructorS = $insrep->getRepository('InstructorBundle:MapInstructorShared')->find($instructor); // Generate Form to edit Instructor Personal Details $ipde = $this->createForm( new IpdeType(), $instructorQ); // Handle Form submission to edit Instructor Personal Details if ($request->getMethod() == 'POST') { $ipde->bind($request); if ($ipde->isValid()) { // perform some action, such as saving the task to the database //if ($this->request->isXmlHttpRequest()){ //return data ajax requires. //} $em = $this->getDoctrine()->getManager(); $em->persist($ipde); $em->flush(); return $this->redirect($this->generateUrl('task_success')); } } // Generate Form to edit Instructor Records $ir = $this->createForm( new IrType(), $instructorQ); // Generate Form to edit Instructor Records $ba = $this->createForm( new BaType(), $instructorS); // Return data to view return $this->render('InstructorBundle:Default:view.html.twig', array( 'ipde' => $ipde->createView(), 'ir' => $ir->createView(), 'ba' => $ba->createView() )); } } 

Однако при отправке формы я получаю следующее сообщение об ошибке:

«Класс« Symfony \ Component \ Form \ Form »не был найден в цепочке имен с настройками цепочки PCUK \ InstructorBundle \ Entity"

Я уже разработал проект Symfony2, и я ссылался на него против этого текущего проекта, чтобы узнать, включен ли я в Symfony\Component\Form\Form , если это на самом деле проблема.

Что происходит?

вы сохраняете $ipde который оказывается формой, а не сущностью!

это, вероятно, источник ошибки.

У вас есть инструкция «use» во всех ваших классах * Type ()? я думаю, это должно быть похоже на

 use Symfony\Component\Form\AbstractType; 

AbstractType использует пространство имен Form.