I'm not sure what you are trying to do here. With a ManyToMany association, 
there is no such thing as a "parent", there's only the "other side".

When you say: "Company: persist > User persist", do you mean that you persist a 
company, and that persist is cascaded towards associated users?

I think you're looking for custom events. Create a service that can do stuff 
like "add user to a company". Create an event likeĀ "UserWasAddedToCompany" 
which should receive the user and company as event-arguments. The service can 
then dispatch that event, and you can have listeners that can take the 
appropriate actions when the event takes place.

--  
Jasper N. Brouwer
(@jaspernbrouwer)


On 31 July 2014 at 10:03:28, Piet Bijl ([email protected]) wrote:
> Hello,
>  
> Is there a way to get a reference to a parent object when persistence or
> whatever is triggered?
>  
> For example:
>  
> Company User
>  
> 1. Company: persist > User persist
> 2. User listener sends mail to regarding company contact with credentials
> etc.
>  
> How do i know which company persisted the user?
>  
> Or:
> 1. Company: delete > User delete
> 2. Listener needs to delete some stuff, again, which company?
>  
> Something in the UOW?
>  
> Gr.


-- 
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