Doctrine查询postgres json(包含)json_array

时间:2015-04-09 13:07:02

标签: json postgresql symfony doctrine-orm

json_array类型的学说保存为postgres database > 9.2 as json datatype

json数据类型上的Postgres supports contains and lots of other operations。是否有可能使用学说中的功能?

可能需要自定义SQLWalker吗?如上所述here。另外,支持JSONB的自定义类型也不错。如上所述here。这将在查询json字段时提高性能。或者是否有自定义库添加json(b)功能,或者甚至可以使用DQL

1 个答案:

答案 0 :(得分:7)

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

希望这有帮助。

https://github.com/boldtrn/JsonbBundle

现在我更喜欢使用NativQueries而不是自定义DQL函数来查询我的jsonb字段。在我的应用程序中,自定义函数过于繁琐。

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