Jsonb type limited convert
halfik opened this issue · comments
JsonB type has now limitation on convertToPhpValue function. You can't convert to some custom php classes now like this:
public function convertToPHPValue($value, AbstractPlatform $platform): Currency
Any reason behind limiting convert to only simple php types?
I don't fully understand your idea. Can you please elaborate with more details?
You limited types int this when it convertio into. It can convert any object itno jsonb, but you won't be able to recreate same object from jsob.
So u can conber instance of my CustomClass but i can't get it back since im limited to simple types only.
Can you add some code samples, please? The phpdoc for Jsonb
clearly says that only array|bool|float|int|string|null
data types are supported.
Yes and that is an issue. You can conver instance of CustomClass
into jsonb on db, but u cant conver from db to CustomClass
bc you can get only array|bool|float|int|string|null
convertToDatabaseValue
allows to convert any object u want into db string
convertToPHPValue
won't allow to recreate it
And its a big issue in DDD aproach where u have lot of domain defined custom objects you want to store as jsonb.