“Invalid PathExpression. Must be a StateFieldPathExpression” in query builder with non related entities

前端 未结 2 1504
感情败类
感情败类 2020-12-06 00:38

I have four entities: OfficialDocument, Media, NMediaStatus and NMediaType. I\'m trying to translate this SQL:

         


        
相关标签:
2条回答
  • 2020-12-06 00:48

    I answer myself since I found how to fix it:

    $qb->select('IDENTITY(od.media)', 'IDENTITY(od.type) AS doc_type', 'IDENTITY(od.status) AS doc_status', 'md.url', 'nms.name', 'nmt.name');
    

    Since od.media, od.type, od.status are composite keys then I need to add IDENTITY in order to make the query work and fix the issue

    0 讨论(0)
  • 2020-12-06 01:09

    Simply you can use () where composite keys exist.

    $qb->select('(od.media)', '(od.type) AS doc_type', '(od.status) AS doc_status', 'md.url', 'nms.name', 'nmt.name');
    
    0 讨论(0)
提交回复
热议问题