mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
MySQL 5.7 JSON ordering affects change computation #5946
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MisatoTremor on GitHub (Apr 10, 2018).
Originally assigned to: @Ocramius on GitHub.
This is not really an issue with ORM itself, but can happen in conjunction with DBAL and MySQL 5.7s JSON type
If you store an associative array as a object property which, due to processing, is always ordered before persisting (e.g.
["baz" => "bar", "foo" => "bar"]) it will be correctly processed byJsonType::convertToDatabaseValueinto{"baz": "bar", "foo": "bar"}But due to MySQLs JSON normalization might end up in the database as
{"foo": "bar", "baz": "bar"}.So when hydrating the object the UOW will store this as value in the original entity data and when computing changes later will detect it as change.