如何解决ORO店面RestAPI相关实体规范化问题
我创建了具有属性AcmeBundle\Api\Model\AcmeLineItem
和product
的模型productUnit
。然后,我添加了一个新的处理器,用于设置模型项的结果集合,并使用标记注册它:
- { name: oro.api.processor,action: get_list,group: load_data,requestType: frontend,class: AcmeBundle\Api\Model\AcmeLineItem,priority: 55 }
api_frontend.yml
中的模型配置:
AcmeBundle\Api\Model\AcmeLineItem:
fields:
quantity:
data_type: string
productSku:
data_type: string
product:
target_class: Oro\Bundle\ProductBundle\Entity\Product
target_type: to-one
property_path: product
productUnit:
target_class: Oro\Bundle\ProductBundle\Entity\ProductUnit
target_type: to-one
actions:
get: false
get_list:
description: Get bought line items
disable_sorting: true
update: false
delete: false
delete_list: false
create: false
简单的请求工作正常,但是使用include
参数时出现了问题。值productUnit
的相关项在响应中可见,但值product
-响应中的异常,具有500条代码和[Semantical Error] line 0,col -1 near 'SELECT r FROM': Error: Cannot select entity through identification variables without choosing at least one root entity alias.
消息。
通过调试,我发现在通过varianProducts
对product
实体的@oro_api.object_normalizer
属性进行规范化期间发生了异常。我没有t found a similar exception for the included products on
shippinglistitems的API方法,像这样的接缝使用了与产品实体不同的规范化器。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。