Problem with reading JSON fields in Postgress

Hi.
We just started to upgrade Yii2 according the need to upgrade to php 7.3 and we are facing bad problem with array and JSON type automatic decoding from db to php.

We use both arrays and JSON intensively and it is hard to go around the new changes in version 2.0.14.

  1. Suggested workarounds with setting up config don’t work, I supposed nobody tested them as code of php classes have comments about what to do and which variable does what but classes never read the configuration from config array

  2. Automatic decoding of json value to array is problem as we are used to work with json from db as class object everywhere.we store class as json and we take it from db as class again. It makes no sense and only creates errors to convert it to array as you do and back to class as we need

Is there any possibility to override classes for DB layer communication ? I mean create my own column schema and do my own processing of columns read from table? It would help us a LOT.

1 Like

Hi TVX,
we are facing same issue , did you got any solution?
Thanks.

Hi.
On one project where there’s a lot of JSON operations, we stay on version before JSON automatic parsing.
On others we encode decoded json back to json and then decode it as a class.

Worst thing of all is automatic decoding of arrays. There we also decode all DB fileds to out format.

Best solution would be modularity and allow user to set his own decoding functionality, which is not the way it works now…