Hi everyone, first post.

I just want to know how i can access to relation modification in a 
preUpdate listener.

For example : I have two entities : User and Group which are related with a 
Many to Many relation :

/**
 * @ORM\Table(name="application_groups")
 * @ORM\Entity()
 */
*class *Group  {

    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id()
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    *private *$id;

    /**
     * @ORM\Column(name="name", type="string", length=30)
     */
    private $name;

    /**
     * @ORM\ManyToMany(targetEntity="User", mappedBy="groups")
     */
    private $users;

    ...
}

and

/**
 * User
 *
 * @ORM\Table()
 * 
@ORM\Entity(repositoryClass="Gbis\Common\AuthBundle\Entity\UserRepository")
 */
*class *User implements AdvancedUserInterface
{
    /**
     * @var integer
     *
     * @ORM\Column(name="ldap")
     * @ORM\Id
     */
    protected $ldap;

    /**
     * @var ArrayCollection
     *
     * @ORM\ManyToMany(targetEntity="Group", inversedBy="users", 
cascade={"persist"})
     * @ORM\JoinTable(name="User_Group",
     *      joinColumns={@ORM\JoinColumn(name="ldap", 
referencedColumnName="ldap")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="id", 
referencedColumnName="id")})
     */
    protected $groups;

    ...
}

And I've created a listener which add in another database all the insert, 
update and delete actions of all others entities( who ? do what ? when ? 
old value ? new value ?).


Then in a controller i try to add one user to a group. But in my preUpdate 
listener, i can't find the modification on the ManyToMany relation 
(User::groups nor Group::users). 

Any idea ?




-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to