sonata-project/EntityAuditBundle

How to audit user roles

braianj opened this issue · 3 comments

Q A
Bug report? no
Feature request? yes
BC Break report? no

Hello, I was able to implement part of the code, and add into config.yml

simple_things_entity_audit:
    global_ignore_columns:
        - ts
        - tu
        - salt
        - password
    audited_entities:
        - LoginBundle\Entity\Users
        - LoginBundle\Entity\Roles

But I can't audit the table users_roles, since there is no entity for that table.
Inside Users entity I have this

  /**
    * @var \Doctrine\Common\Collections\Collection
    *
    * @ORM\ManyToMany(targetEntity="LoginBundle\Entity\Roles", inversedBy="users")
    * @ORM\JoinTable(name="users_roles",
    *   joinColumns={
    *     @ORM\JoinColumn(name="id_user", referencedColumnName="id")
    *   },
    *   inverseJoinColumns={
    *     @ORM\JoinColumn(name="id_rol", referencedColumnName="id")
    *   }
    * )
    */
   private $roles;

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

And inside roles

/**
  * @var \Doctrine\Common\Collections\Collection
  *
  * @ORM\ManyToMany(targetEntity="LoginBundle\Entity\Users", mappedBy="roles")
  */
 private $users;

And then it will be usefull to know how to user the templates already created by this repo.

Best

tolry commented

Not an expert on these advanced features, but take a look at #99

Does anyone have a solution for this?

I'm using v1.0.7

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.