我一定是个盲人。我不知道为什么,但我遇到了一个例外:
FatalErrorException: Error: Class 'BConway\WebsiteBundle\Form\Type\BusinessType' not found
这是我的文件:
<?php
namespace BConway\WebsiteBundle\Controller;
use BConway\WebsiteBundle\Document\Business;
use BConway\WebsiteBundle\Form\Type\BusinessType;
use Doctrine\Common\Util\Debug;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class BusinessController extends Controller
{
public function newAction(Request $request)
{
$formBusiness = $this->createForm(new BusinessType(), new Business());
$formBusiness->handleRequest($request);
return $this->render('BConwayWebsiteBundle:Business:new.html.twig', array(
'formBusiness' => $formBusiness->createView(),
'action' => 'create',
));
}
}
<?php
// src/BConway/WebsiteBundle/Form/Type/BusinessType.php
namespace BConway\WebsiteBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use BConway\WebsiteBundle\Form\Type\AddressType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class BusinessType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('ad', 'string')
->add('address', new AddressType())
->add('claimed', 'boolean')
->add('coupons', 'string')
->add('dateCreated', 'date')
->add('dateModified', 'date')
// ->add('hours', 'collection', array('type' => new HoursType()))
->add('name', 'string')
->add('organization', 'string')
->add('permanentlyClosed', 'string')
->add('phone', 'string')
// ->add('services', 'collection', array('type', new ServiceType()))
->add('tags', 'collection')
->add('website', 'string');
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'BConway\WebsiteBundle\Document\Business',
));
}
public function getName()
{
return 'business';
}
}
我没看到什么?我一直盯着这些文件一个小时,我找不到问题。
我为这一部分道歉,但不允许我提交我的问题,因为其中太多是代码与文本......所以我只是在填补空间。