Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未找到类,尽管它已被正确引用_Php_Symfony - Fatal编程技术网

Php 未找到类,尽管它已被正确引用

Php 未找到类,尽管它已被正确引用,php,symfony,Php,Symfony,我一定是瞎了。我不知道为什么,但我得到了一个例外: FatalErrorException: Error: Class 'BConway\WebsiteBundle\Form\Type\BusinessType' not found 这是我的档案: <?php namespace BConway\WebsiteBundle\Controller; use BConway\WebsiteBundle\Document\Business; use BConway\WebsiteBundl

我一定是瞎了。我不知道为什么,但我得到了一个例外:

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';
    }
}

我在MyBundle\Form中有FormType.php文件,我没有创建MyBundle\Form\Type文件夹。

您的文件系统区分大小写吗?您是否尝试手动删除缓存?@LarsStrojny:是的,Ubuntu…您认为区分大小写会有什么问题?文件
BusinessType.php
的权限正确吗?是的。这是我的第一个使用DoctrineMongoDBBundle的项目,我以前在MySQL中使用过Doctrine。我想知道这是否有关系。我做的每件事都和平时一模一样。