Doctrine查询postgres json(包含)json_array [英] Doctrine query postgres json (contains) json_array

查看:171
本文介绍了Doctrine查询postgres json(包含)json_array的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

json_array 的学说类型保存到 postgres数据库> 9.2作为json数据类型

Postgres 支持在json数据类型上包含和大量其他操作。有没有可能使用原则中的功能?

Postgres supports contains and lots of other operations on the json datatype. Is there any possibility to use the functionalities in doctrine?

可能需要一个自定义SQLWalker?如 here 。另外,支持 JSONB 的自定义类型将会很好。如 here 所述。这将增加查询json字段时的性能。或者有一个自定义库添加 json(b)功能,或者甚至可以使用 DQL

Probably a custom SQLWalker is needed for that? As described here. Also a custom type supporting JSONB would be nice. As described here. This would increase the performance when querying for the json field. Or is there a custom lib that adds the json(b) functionality or is it even possibile using DQL.

推荐答案

我创建了一个支持jsonb的Symfony2 Bundle。

I created a Symfony2 Bundle that supports jsonb.

希望这有帮助。

https://github.com/boldtrn/JsonbBundle

现在我更喜欢使用NativQueries而不是自定义的DQL函数来查询我的jsonb字段。自定义函数在我的应用程序中太麻烦了。

Right now I prefer to use NativQueries instead of custom DQL functions to query for my jsonb fields. The custom functions are too cumbersome in my application.

所有内容都应该在Bundle中记录。

Everything should be documented in the Bundle as well.

这篇关于Doctrine查询postgres json(包含)json_array的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆