方法中的“@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route”...不存在,或无法自动加载”
"@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" in method ... does not exist, or could not be auto-loaded"
我正在将 symfony 的版本从 2.8 升级到 3.0.9,在修复了一些库版本的错误和其他问题之后,我尝试了 运行 命令“php bin/console cache:clear" 有问题:
C:\inetpub\wwwroot0forfuture>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\wwwroot0forfuture\src\H360\
ParkingBundle/Controller/DisponibilidadController.php (which is being imported from "C:\inetpub\wwwroot0forfuture\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 和这......或者现在的语法不同了。
有什么想法吗?
终于,我解决了这个问题。文件“autoload.php”是错误的。
我正在将 symfony 的版本从 2.8 升级到 3.0.9,在修复了一些库版本的错误和其他问题之后,我尝试了 运行 命令“php bin/console cache:clear" 有问题:
C:\inetpub\wwwroot0forfuture>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\wwwroot0forfuture\src\H360\
ParkingBundle/Controller/DisponibilidadController.php (which is being imported from "C:\inetpub\wwwroot0forfuture\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 和这......或者现在的语法不同了。 有什么想法吗?
终于,我解决了这个问题。文件“autoload.php”是错误的。