gpt4 book ai didi

php - 不允许使用父属性

转载 作者:行者123 更新时间:2023-12-01 21:23:33 24 4
gpt4 key购买 nike

基于此示例:http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html

我尝试在 FOSRestBundle 实现中使用父级。然而问题是,父属性似乎不再被识别或不再支持。有什么建议吗?

bla_rest_api_Location:
type: rest
parent: bla_rest_api_User
resource: Bla\RestUserBundle\Controller\LocationController

异常(exception):

 [Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "C:\xampp\htdocs\EntisServer\src\VSmart\RestUserBund
le/Resources/config/routing.yml" from "C:/xampp/htdocs/EntisServer/app/conf
ig\routing.yml". (The routing file "C:\xampp\htdocs\EntisServer\src\VSmart\
RestUserBundle/Resources/config/routing_generated.yml" contains unsupported
keys for "v_smart_rest_api_Location": "parent". Expected one of: "resource
", "type", "prefix", "pattern", "path", "host", "schemes", "methods", "defa
ults", "requirements", "options", "condition".)

最佳答案

我隐约记得有关链接到包含这些资源的文件的资源需要为休息类型的信息(因此您的 VSmartRestUserBundle:app/config/routing.yml 中的路由资源的链接需要为休息类型)。

不过我可能是错的,我并没有真正使用父功能。

事实上,有说明here .

Notice parent: users option in the second case. 
This option specifies that the comments resource is child of the users resource.

It is also necessary to add type: rest to the routing.yml file:

# app/config/routing.yml
acme_hello:
type: rest
resource: "@AcmeHelloBundle/Resources/config/users_routes.yml"

关于php - 不允许使用父属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24907980/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com