Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore related tables for auditiong #601

Open
dmitrach opened this issue Jan 22, 2024 · 2 comments · May be fixed by #622
Open

Ignore related tables for auditiong #601

dmitrach opened this issue Jan 22, 2024 · 2 comments · May be fixed by #622
Labels

Comments

@dmitrach
Copy link

Feature Request

I would like to ignore a related table with M:M for auditing.

Actually it is not possible as I see and I cannot change the current library.

https://stackoverflow.com/questions/77801195/how-to-ignore-many-to-many-relationship-with-entityaudit-entityauditbundle?noredirect=1#comment137179292_77801195

<?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();
    }

    // ...
}
simple_things_entity_audit:
    audited_entities:
        - App\Entity\User
        - 
    global_ignore_tables:
        - friends

Thanks.

@shepherdmat
Copy link

shepherdmat commented Mar 28, 2024

How about instead of excluding individual tables, add an option to skip relationships.

simple_things_entity_audit:
    disable_associations: true
    audited_entities:
        - App\Entity\User

@VincentLanglet
Copy link
Member

How about instead of excluding individual tables, add an option to skip relationships.

simple_things_entity_audit:
    disable_associations: true
    audited_entities:
        - App\Entity\User

Would it solve your issue @dmitrach ?

One issue I see here @shepherdmat is the fact it's all-or-nothing.
Maybe the use case is to keep the behavior for some relations but exclude others relations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants