Symfony 2 FosUserBundle:“500内部服务器错误”

时间:2012-11-10 14:56:58

标签: php symfony fosuserbundle

我尝试使用Symfony II生产模式访问我的网站时出现此错误(它在DEV模式下工作)

SF日志错误: CRITICAL

  

链中找不到“Camplica \ UserBundle \ Entity \ User”类   配置的命名空间FOS \ UserBundle \ Entity。我无法建立自己的网站   工作..

当我使用开发模式访问我的网站时效果很好,但在使用生产模式时它无效。 我无法解决我的问题,我看不出它来自哪里。

应用/配置/ routing.yml中

camplica_home:
    resource: "@CamplicaHomeBundle/Resources/config/routing.yml"
    prefix:   /CamPlica

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /CamPlica/profile

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /CamPlica/register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /CamPlica/resetting

fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /CamPlica/change-password
# Internal routing configuration to handle ESI
#_internal:
#    resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
#    prefix:   /_internal

Camplica / UserBundle /实体/ user.php的

<?php
// src/Sdz/UserBundle/Entity/User.php

namespace Camplica\UserBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="Camplica_user")
 */
class User extends BaseUser
{

//....

}

应用/ AppKernel.php

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            **new Camplica\UserBundle\CamplicaUserBundle(),**
            new Camplica\HomeBundle\CamplicaHomeBundle(),
            new FOS\UserBundle\FOSUserBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

编辑: 我不知道它是否与我的严重错误有关但我在我的日志文件中得到了这个。 request.INFO:匹配路线 “索引”(参数: “_controller”: “Camplica \ HomeBundle \控制器\ DefaultController ::的indexAction”, “_route”: “索引”)[] []

清除缓存后..我仍然得到同样的错误:(

0 个答案:

没有答案