How to ignore Many-To-Many relationship with EntityAudit (EntityAuditBundle)?

38 views Asked by At

I use https://github.com/sonata-project/EntityAuditBundle that audits changes of entities.

I have a code likes this: https://www.doctrine-project.org/projects/doctrine-orm/en/2.4/reference/association-mapping.html#many-to-many-self-referencing

<?php
/** @Entity **/
class User
{
    // ...

    /**
     * @ManyToMany(targetEntity="User", mappedBy="myFriends")
     **/
    private $friendsWithMe;

    /**
     * @ManyToMany(targetEntity="User", inversedBy="friendsWithMe")
     * @JoinTable(name="friends",
     *      joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
     *      inverseJoinColumns={@JoinColumn(name="friend_user_id", referencedColumnName="id")}
     *      )
     **/
    private $myFriends;

    public function __construct() {
        $this->friendsWithMe = new \Doctrine\Common\Collections\ArrayCollection();
        $this->myFriends = new \Doctrine\Common\Collections\ArrayCollection();
    }

    // ...
}

My entity is audited.

simple_things_entity_audit:
    audited_entities:
        - App\Entity\User

The entity has a lot of audited properties (columns), but it also audits the M:M relationship. I don't want to audit this relation and the join table.

Is it possible to avoid it?

I would like to have an option like this to ignore the M:M relation.


simple_things_entity_audit:
    global_ignore_tables:
        - friends
0

There are 0 answers