I have changed which have to be the owning side according to this http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#owning-and-inverse-side-on-a-manytomany-association but I still cannot get the changes using $changeset = $eventArgs->getEntityChangeSet();
How should I get the changes Regards, Plamen Vasilev 2 On Wed, Sep 27, 2017 at 11:59 AM, Marco Pivetta <[email protected]> wrote: > Only the owning side of the association will then contain changes ;-) > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > On Wed, Sep 27, 2017 at 10:50 AM, Plamen V. Vasilev < > [email protected]> wrote: > >> Sorry, I'm wrong .. the relation is ManyToMany with mapping table >> person_address, but it can be also OneToMany yes. >> >> >> Regards, >> Plamen Vasilev 2 >> >> On Wed, Sep 27, 2017 at 11:27 AM, Marco Pivetta <[email protected]> >> wrote: >> >>> Are you sure that you don't have a OneToMany rather than a ManyToOne? >>> OneToMany is completely ignored by the ORM, so you won't get any diffs >>> there. >>> >>> Marco Pivetta >>> >>> http://twitter.com/Ocramius >>> >>> http://ocramius.github.com/ >>> >>> On Wed, Sep 27, 2017 at 9:16 AM, <[email protected]> wrote: >>> >>>> >>>> Hi all, >>>> >>>> does any one knows how I can get the entity ManyToOne collection >>>> changes inside Entity listener? >>>> >>>> I have entity Person and entity Address with ManyToOne relation (one >>>> person has many addresses) >>>> >>>> I want to be able to see what is changing when the Person is changing >>>> his Addresses >>>> >>>> public function preUpdate(PreUpdateEventArgs $eventArgs){ >>>> $entity = $eventArgs->getEntity(); >>>> if ($entity instanceof Person) { >>>> $em = $eventArgs->getEntityManager(); >>>> $uow = $em->getUnitOfWork(); >>>> $changeset = $eventArgs->getEntityChangeSet(); >>>> $original = $uow->getOriginalEntityData($owner); >>>> } >>>> } >>>> >>>> the $changeset doesn't have Addresses info because of ManyToOne relation >>>> $eventArgs->hasChangedField('addresses'); also doesn't know if one of >>>> the addresses is changed. >>>> $original also doesn't have the field address >>>> >>>> How can I see if the one of the addresses is changed and see the >>>> difference (to make validation or backup for example)? >>>> >>>> -- >>>> 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 https://groups.google.com/group/doctrine-user. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> 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 https://groups.google.com/group/doctrine-user. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> 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 https://groups.google.com/group/doctrine-user. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 https://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
