To avoid side effects during Doctrine ORM PHP-value-to-database-value conversion, this PR in part reverts design changes from #28:
On the preFlush event, remove all PersistentTranslatable instances from managed entities and replace them with their plain (primary) values. On postFlush, but the PersistentTranslatables back in place.
That way, the default (plain) values are in place when the ORM does its change detection.
Previously, in fact PersistentTranslatables were casted to string when the ORM gathered the values to insert into the database. That does not work when the column type is object, since it would try to serialize the PersistentTranslatable itself.
To avoid side effects during Doctrine ORM PHP-value-to-database-value conversion, this PR in part reverts design changes from #28:
On the
preFlush
event, remove allPersistentTranslatable
instances from managed entities and replace them with their plain (primary) values. OnpostFlush
, but thePersistentTranslatable
s back in place.That way, the default (plain) values are in place when the ORM does its change detection.
Previously, in fact
PersistentTranslatables
were casted to string when the ORM gathered the values to insert into the database. That does not work when the column type isobject
, since it would try to serialize thePersistentTranslatable
itself.