映射异常:类不存在Symfony2部署

Sei*_*yed 2 deployment doctrine mappingexception symfony

我在localhost上有一个工作项目,但是当我部署项目时,我收到了这个错误,我不知道是什么导致了这种情况发生.

 MappingException: Class 'PremiumPharma\SystemBundle\Entity\User' does not exist
Run Code Online (Sandbox Code Playgroud)

这是堆栈跟踪

in /home/sy2/public_html/temp/symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php line 96
at MappingException::nonExistingClass('PremiumPharma\SystemBundle\Entity\User') in /home/sy2/public_html/temp/symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php line 43
at RuntimeReflectionService->getParentClasses('PremiumPharma\SystemBundle\Entity\User') in /home/sy2/public_html/temp/symfony/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 267
Run Code Online (Sandbox Code Playgroud)

编辑1 我确实注意到探查器中有一些错误,因为它说5个无效实体,并且有一些映射错误,我修复了它们.重新上传后,我仍然有同样的问题.我也尝试清空缓存,但仍然收到相同的错误.

编辑2

这是我的appKernal

<?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 PremiumPharma\SystemBundle\PremiumPharmaSystemBundle(),
            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');
    }
}
Run Code Online (Sandbox Code Playgroud)

编辑3

根据J.Mose的最后评论,这是一个unix/windows冲突,因为我的本地机器是Windows,服务器是Unix.我不得不重命名所有文件以完全匹配类名.

j-g*_*yon 6

您是否在此环境中部署了旧版本?

如果是,在部署之前是否删除了所有应用程序的文件?如果项目中不再存在(或重命名)实体的旧版本,则可能会引发这种映射错误.

或者,如果在所有环境中启用了包含实体的捆绑包,请检入AppKernel.php.

此外,如果应用程序部署在Unix环境中(针对本地Windows),请检查您的实体名称是否与php文件完全相同(因为Windows不区分大小写)