我在尝试使用 Symfony II 生产模式访问我的网站时遇到此错误(它在 DEV 模式下工作)
SF 日志错误:严重
在链配置的命名空间 FOS\UserBundle\Entity 中找不到类“Camplica\UserBundle\Entity\User”。我不能让我的网站工作..
当我使用开发模式访问我的网站时效果很好,但在使用生产模式时它不起作用。我无法解决我的问题,我看不到它来自哪里。
应用程序/配置/路由.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/Entity/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\Controller\DefaultController::indexAction”,“_route”:“索引”)[] []
清除缓存后..我仍然得到同样的错误:(