EntityAuditBundle
EntityAuditBundle copied to clipboard
allow ManyToMany associations with referenced column name different from 'id'
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'.