Example #1
0
 /**
  * @param array $entities
  */
 protected function addNewEntityOwnedByEmail($entities)
 {
     if ($entities) {
         foreach ($entities as $entity) {
             if ($this->emailOwnersProvider->supportOwnerProvider($entity)) {
                 $this->entitiesOwnedByEmail[] = $entity;
             }
         }
     }
 }
Example #2
0
 /**
  * @param PostFlushEventArgs $event
  */
 protected function addAssociationWithEmailActivity(PostFlushEventArgs $event)
 {
     if ($this->entitiesOwnedByEmail) {
         $em = $event->getEntityManager();
         foreach ($this->entitiesOwnedByEmail as $entity) {
             $emails = $this->emailOwnersProvider->getEmailsByOwnerEntity($entity);
             foreach ($emails as $email) {
                 $this->emailActivityManager->addAssociation($email, $entity);
             }
         }
         $this->entitiesOwnedByEmail = [];
         $em->flush();
     }
 }