How would I extend the Entity Log to capture changes in a Many-to-Many relationship?
Or perhaps, what is the reasoning for not including “-TO-MANY” relationships?
I’m not sure it’s technically possible, because in case of non-owning (mappedBy
) side of relationship the master entity is not necessarily changed when its reference collection changed.
That is a fair point. I suppose a workaround would be to create an entity linking the two. So instead of Vendors having a Many-Many relation to Services, there would be a VendorServiceLink entity with a Many-One relation to Vendors and a Many-One relation to Services. And then create a log for that entity.
I would also recommend updating the docs to reflect the fact that to-many relationships are not logged. It is not clear in the current version.
2 Likes