我基本上遵循本教程:http://welcometothebundle.com/symfony2-rest-api-the-best-2013-way/
我已经创建了我的第一个控制器,但是一旦我开始添加路线: routing.yml中
strego_user_controller:
resource: "@StregoUserBundle/Controller"
type: annotation
strego_user_rest:
type: rest
prefix: /api
resource: "@StregoUserBundle/Resources/config/rest_routing.yml"
rest_routing.yml
strego_user_rest_groups:
type: rest
prefix: /v1
resource: "Strego/UserBundle/Controller/UserGroupRestController"
name_prefix: api_1_
当我现在执行缓存时:清除我得到以下异常:
不能重新宣布上课 Strego \ UserBundle \ Controller \ UserGroupRestController in /Users/marc/Sites/gambify/src/Strego/UserBundle/Controller/UserGroupRestController.php 在第33行
最终由以下原因引起:
.......
PHP 28. FOS\RestBundle\Routing\Loader\RestRouteLoader->getControllerLocator() /Users/marc/Sites/gambify/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php:77
PHP 29. class_exists() /Users/marc/Sites/gambify/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php:119
PHP 30. Composer\Autoload\ClassLoader->loadClass() /Users/marc/Sites/gambify/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php:0
PHP 31. Composer\Autoload\includeFile() /Users/marc/Sites/gambify/vendor/composer/ClassLoader.php:269
我不知道如何避免这种情况。
答案 0 :(得分:0)
问题与我班上的/和\有关。 不知何故,如果类存在的话调用是假的,但路径的结果是有效的,所以带有类定义的文件被包含两次。