/**
  * @param OnFlushEventArgs $event
  */
 public function onFlush(OnFlushEventArgs $event)
 {
     $em = $event->getEntityManager();
     $uow = $em->getUnitOfWork();
     $emailAddressData = $this->emailOwnerManager->createEmailAddressData($uow);
     $updatedEmailAddresses = $this->emailOwnerManager->handleChangedAddresses($emailAddressData);
     foreach ($updatedEmailAddresses as $emailAddress) {
         $this->computeEntityChangeSet($em, $emailAddress);
     }
     $createdEmails = array_filter($uow->getScheduledEntityInsertions(), $this->getEmailFilter());
     $this->createdEmails = array_merge($this->createdEmails, $createdEmails);
     $this->activityManagerEmails = array_merge($this->activityManagerEmails, $createdEmails);
     $this->updatedEmails = array_merge($this->updatedEmails, array_filter($uow->getScheduledEntityUpdates(), $this->getEmailFilter()));
     $this->addNewEntityOwnedByEmail($uow->getScheduledEntityInsertions());
 }
 /**
  * @dataProvider createEmailAddressDataProvider
  */
 public function testCreateEmailAddressData(UnitOfWork $uow, $result)
 {
     $this->assertEquals($result, $this->emailOwnerManager->createEmailAddressData($uow));
 }