没有加载dev注释的Symfony 2.8到3.3迁移

时间:2018-02-27 20:16:12

标签: php symfony annotations migration autoload

我正在迁移2.8 => 3.3 我用过这个tutorial 但是当我试图清除dev上的缓存时,我抓住了这个Exceprion:

  

[学说\共同\注解\ AnnotationException]
    [语义错误]类AppBundle \ Controller \ Applicati中的注释“@Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route”     onController不存在,或者无法自动加载。

但在prod上一切正常:

  

//使用debug false

清除prod环境的缓存

我的app.php

<?php

 use Symfony\Component\HttpFoundation\Request;

 require __DIR__.'/../vendor/autoload.php';
 if (PHP_VERSION_ID < 70000) {
     include_once __DIR__.'/../var/bootstrap.php.cache';
 }

 $kernel = new AppKernel('prod', false);
 if (PHP_VERSION_ID < 70000) {
     $kernel->loadClassCache();
 }
 $request = Request::createFromGlobals();
 $response = $kernel->handle($request);
 $response->send();
 $kernel->terminate($request, $response);

app_dev.php

require __DIR__.'/../vendor/autoload.php';
Debug::enable();

$kernel = new AppKernel('dev', true);
if (PHP_VERSION_ID < 70000) {
   $kernel->loadClassCache();
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

我真的不明白为什么所有这些都适用于prod而失败dev

需要

    "symfony/symfony": "3.3.15",
    "symfony/validator": "3.3.*",
    "sensio/distribution-bundle": "^5.0.19",
    "sensio/framework-extra-bundle": "^5.1.6",

0 个答案:

没有答案