auditor icon indicating copy to clipboard operation
auditor copied to clipboard

Changes in ManyToMany associations are not recognized / logged

Open micronax opened this issue 1 year ago • 2 comments

The readme states:

many to many relation changes, association and dissociation actions.

But actually, when changing a many-to-many relation (in terms of their assigned values) on an entity with the #[Auditor\Auditable] attribute, the changes are not recognized / logged.

All other properties work like a charm.

Am I doing something wrong?

micronax avatar Dec 10 '24 19:12 micronax

@micronax thanks for the report, can you give me some example code that reproduces the problem?

DamienHarper avatar Jan 10 '25 06:01 DamienHarper

I can confirm this issue as well, for many to many unidirectional relation.

There is many to many association from entity "User" to entity "Group", very simple

Image

Here are the generated tables:

Image

So you see, user_group_audit table should exist if audit supports audit of many-to-many relations.

Does this helps? Ping me if you need more info.

TheCelavi avatar Oct 01 '25 07:10 TheCelavi

I'm new to auditor and just started trying to port my own audit system onto auditor-bundle, so I'm not yet that familiar with Auditor's approach (I had a single audit table before my client's company blew up in size haha).

I'm not sure if the user_group_audit approach is more in line with auditor's approach, but I wonder if it should be treated more like OneToMany, where I'd log the change at each entity's own audit table - that way I could see handling nullable relationships etc.

Do I make sense or should I try to cook up an example?

kachnitel avatar Dec 24 '25 21:12 kachnitel