/** * Overriden. Added support for ManyToMany association changes * * {@inheritDoc} */ public function getObjectChangeSet($uow, $object) { $changeSet = parent::getObjectChangeSet($uow, $object); $meta = $this->getObjectManager()->getClassMetadata(get_class($object)); $refl = $meta->getReflectionClass(); $updates = $uow->getScheduledCollectionUpdates(); $delitions = $uow->getScheduledCollectionDeletions(); foreach ($meta->getAssociationNames() as $name) { if ($meta->isSingleValuedAssociation($name)) { continue; } $property = $refl->getProperty($name); $property->setAccessible(true); $assoc = $property->getValue($object); if (in_array($assoc, $updates, true) || in_array($assoc, $delitions, true)) { $changeSet[$name] = [$assoc, $assoc]; } } return $changeSet; }