php - 方法中的“@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”是错误的。
推荐阅读
- visual-studio - Azure DevOps 构建支持直接引用单独的项目,而不是通过 Visual Studio 通过 Nuget
- reactjs - 即使 action/reducer 没有更改该值,状态值也会更改
- java - 将本地 jar 添加到 mvn war 项目
- python - 如何在函数中使用 cv2.VideoWriter 将视频静止帧
- java - 无法从 API 响应中获取特定参数
- json - AdaptiveChars v1.2 架构更新
- html - 如何向使用 JavaScript 动态创建的 SVGRect 添加类?
- vaadin - Vaadin 流程:byte[] 到图像
- javascript - OAuth2“不允许加载本地资源:chrome-error://chromewebdata/#buttons”
- python - 如何将标签分配给变量的值