EntityAuditBundle icon indicating copy to clipboard operation
EntityAuditBundle copied to clipboard

allow ManyToMany associations with referenced column name different from 'id'

Open awm1 opened this issue 7 months ago • 0 comments

Subject

I've found out that if I want to audit entity with ID column with name different from 'id' :

class User { /** * @ORM\Id() * @ORM\Column(name="user_name",type="string") / private $userName; /* * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Department", inversedBy="members", cascade={"persist"}) * @ORM\JoinTable( * name="systemusers_department_membership", * joinColumns={@ORM\JoinColumn(name="systemusers_id", referencedColumnName="user_name")}, * inverseJoinColumns={@ORM\JoinColumn(name="department_id", referencedColumnName="id")} * ) */ private $departmentMembership; }

...those ManyToMany assoc isn't referred by its correct identifier name, but static 'id' string which will throw Exception. So I try to get it from available source, however I'm not sure if this is the right way to obtain it. I am targeting 1.x branch because this is simple fix which should not break anything.

Changelog

### Fixed
Accessing ManyToMany associations of audited entity with identity field of name different from 'id'.  


awm1 avatar Jul 25 '24 07:07 awm1