Cache:clear 失败,注释“@Doctrine\ORM\Mapping\HasLifeCycleCallbacks”...不存在

Cache:clear fails with The annotation "@Doctrine\ORM\Mapping\HasLifeCycleCallbacks" ... does not exist

我正在尝试为我的客户制作预览版。

我的开发主机在预览环境中一切正常。

我创建了一个 tarball,排除了现场不需要的东西。

tar \
  --create \
  --auto-compress \
  --dereference \
  --exclude=.DS_Store \
  --exclude=.git \
  --exclude=.idea \
  --exclude=.nfs* \
  --exclude=node_modules \
  --exclude=tests \
  --exclude=var/cache/* \
  --exclude=ToDo* \
  --exclude=var/logs/* \
  --exclude=var/sessions/* \
  --exclude=web/tickets/* \
  --file ./preview.tgz

我将压缩包传输到目标主机并解压。

然后cd进目录下发

sudo bin/console cache:clear --env=preview

Symfony 抛出以下错误:

[Doctrine\Common\Annotations\AnnotationException]

[Semantical Error] The annotation "@Doctrine\ORM\Mapping\HasLifeCycleCallbacks" in class Bcs\BcsVmsUserBundle\Entity\VmsUser does not exist, or could not be auto-loaded.

我手动删除了缓存目录的内容,还是报错

2016-0801-1124:附加信息。

来自 console cache:clear --env=preview

的详细输出
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\HasLifeCycleCallbacks" in class Bcs\BcsVmsUserBundle\Entity\VmsUser does not exist, or could not be auto-loaded.


Exception trace:
 () at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54
 Doctrine\Common\Annotations\AnnotationException::semanticalError() at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:708
 Doctrine\Common\Annotations\DocParser->Annotation() at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:641
 Doctrine\Common\Annotations\DocParser->Annotations() at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:334
 Doctrine\Common\Annotations\DocParser->parse() at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php:195
 Doctrine\Common\Annotations\AnnotationReader->getClassAnnotations() at /var/www/wwui/preview/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:83
 Doctrine\Common\Annotations\CachedReader->getClassAnnotations() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php:63
 Doctrine\ORM\Mapping\Driver\AnnotationDriver->loadMetadataForClass() at /var/www/wwui/preview/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php:102
 Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:151
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at /var/www/wwui/preview/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at /var/www/wwui/preview/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
 Doctrine\ORM\EntityManager->getClassMetadata() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
 Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository() at /var/www/wwui/preview/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
 Doctrine\ORM\EntityManager->getRepository() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:450
 appPreviewDebugProjectContainer->getBcs_Vmsuser_RepositoryService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:437
 appPreviewDebugProjectContainer->getBcs_Vmsuser_LoaderService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:411
 appPreviewDebugProjectContainer->getBcs_Vmsuser_AuthenticatorService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:4403
 appPreviewDebugProjectContainer->getSecurity_Authentication_ManagerService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:2476
 appPreviewDebugProjectContainer->getSecurity_AuthorizationCheckerService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:1103
 appPreviewDebugProjectContainer->getDplhMenuUtilityService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/var/cache/preview/appPreviewDebugProjectContainer.php:1077
 appPreviewDebugProjectContainer->getDplhMenuDebugCommandService() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275
 Symfony\Component\DependencyInjection\Container->get() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:123
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:98
 Symfony\Bundle\FrameworkBundle\Console\Application->all() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:72
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/wwui/preview/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:117
 Symfony\Component\Console\Application->run() at /var/www/wwui/preview/bin/console:29

开发主持:

目标主机:

建议?

原来@Doctrine\ORM\Mapping\HasLifeCycleCallbacks应该是@Doctrine\ORM\Mapping\HasLifecycleCallbacks(循环中的小写c)。

我在 Mac 上开发,默认情况下文件系统不区分大小写,并部署到 Ubuntu。

非常感谢#symfony IRC 节点上的 sfix 和 trq 提供此答案。