6

The json_array type of doctrine is saved to a postgres database > 9.2 as json datatype.

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

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.

Robin
  • 3,512
  • 10
  • 39
  • 73
  • I'm looking for the same thing, i found this while searching: https://github.com/opsway/doctrine-dbal-postgresql though it's still missing some operators. About jsonb I can tell you they are implementing the jsonb data type through an option but it's not available yet https://github.com/doctrine/dbal/pull/824 – valepu May 20 '15 at 10:18
  • 2
    @valepu I created a Symfony Bundle to support jsonb. https://github.com/boldtrn/JsonbBundle it works well – Robin May 20 '15 at 13:24
  • 1
    nice to hear, i might be using this sooner or later – valepu May 20 '15 at 14:03

1 Answers1

7

I created a Symfony2 Bundle that supports jsonb.

Hope this helps.

https://github.com/boldtrn/JsonbBundle

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.

Everything should be documented in the Bundle as well.

Robin
  • 3,512
  • 10
  • 39
  • 73