Documentation clarification - how to track changes to Custom Types that map to PHP objects #5329

Open
opened 2026-01-22 15:04:40 +01:00 by admin · 1 comment
Owner

Originally created by @courtney-miles on GitHub (Nov 19, 2016).

I have a custom type that maps an ArrayCollection of PHP object to JSON, and I need the changes persisted the database any time the ArrayCollection changes, or the properties of the objects within the array collection changes.

I have found a few people report that objects are not tracked by UnitOfWork -- which is why my UPDATEs are not working. If this were true, and that Custom Types can only be tracked if they map to PHP scalars or arrays, I would expect the Custom Mapping Types documentation to include disclaimer about this.

If PHP Objects can be tracked by UnitOfWork, can the documentation be updated with some details of strategy for how?

I was hoping UnitOfWork would be able to use convertToDatabaseValue() for a before an after check to determine changes on a custom type.

Originally created by @courtney-miles on GitHub (Nov 19, 2016). I have a **custom type** that maps an ArrayCollection of PHP object to JSON, and I need the changes persisted the database any time the ArrayCollection changes, or the properties of the objects within the array collection changes. I have found a few people report that objects are not tracked by UnitOfWork -- which is why my UPDATEs are not working. If this were true, and that Custom Types can only be tracked if they map to PHP scalars or arrays, I would expect the [Custom Mapping Types documentation](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/custom-mapping-types.html) to include disclaimer about this. If PHP Objects can be tracked by UnitOfWork, can the documentation be updated with some details of strategy for how? I was hoping UnitOfWork would be able to use `convertToDatabaseValue()` for a before an after check to determine changes on a custom type.
Author
Owner

@Aliance commented on GitHub (Mar 15, 2024):

https://github.com/doctrine/orm/issues/5542

@Aliance commented on GitHub (Mar 15, 2024): https://github.com/doctrine/orm/issues/5542
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5329