方法中的“@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route”不存在,或无法自动加载”

问题描述

我正在将 symfony 的版本从 2.8 升级到 3.0.9,在修复了一些库版本的错误和其他问题后,我尝试运行命令“php bin/console cache:clear”,但出现问题:

C:\inetpub\wwwroot\360forfuture>php bin/console cache:clear

 // Clearing the cache for the dev environment with debug true



  [Symfony\Component\Config\Exception\FileLoaderLoadException]
  [Semantical Error] The annotation "@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" in method H360\ParkingBundle\Controller\DisponibilidadController::indexAction() does not exist,or could not be auto-loaded in C:\inetpub\wwwroot\360forfuture\src\H360\
  ParkingBundle/Controller/DisponibilidadController.php (which is being imported from "C:\inetpub\wwwroot\360forfuture\src\H360\ParkingBundle/Resources/config/routing.yml").



  [Doctrine\Common\Annotations\AnnotationException]
  [Semantical Error] The annotation "@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" in method H360\ParkingBundle\Controller\DisponibilidadController::indexAction() does not exist,or could not be auto-loaded.


cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

这是我的文件“DisponibilidadController.php”的一部分:

namespace H360\ParkingBundle\Controller;

use H360\generalBundle\Tools\Controller360 as Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use H360\ParkingBundle\Entity\ParParkingPlazas;
use H360\ParkingBundle\Entity\ParParkingReservas;
use H360\ParkingBundle\Form\GenDisponibilidadParkingType;
use H360\ParkingBundle\Form\GenCrearReservaParkingType;

/**
 * 
 */
class DisponibilidadController extends Controller {

    /**
     * @Route("/index",name="disponibilidad_parking_index")
     *   
     * 
     */
    public function indexAction() {

        // Formulario de búsqueda
        $options = array();
        $options['establecimiento'] = $this->IdEstabActual();
        ...

这是我文件“routing.yml”的一部分:

parking_disponibilidad:
    resource: "@ParkingBundle/Controller/DisponibilidadController.php"
    prefix:   /disponibilidad
    type:     annotation

所以,要记住的另一件事是,在新的 Symfony 版本中,我在 config.yml 中启用了“sensio_framework_extra”...也许 RestBundle 和 this 之间存在冲突...或者 sintax 是现在不同了。 有什么想法吗?

解决方法

最后,我解决了这个问题。文件“autoload.php”是错误的。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...