Example #1
0
 /**
  * @param OnFlushEventArgs $event
  */
 public function onFlush(OnFlushEventArgs $event)
 {
     $uow = $event->getEntityManager()->getUnitOfWork();
     $this->emailOwnerManager->handleOnFlush($event);
     $this->emailThreadManager->handleOnFlush($event);
     $this->emailActivityManager->handleOnFlush($event);
     $this->addNewEntityOwnedByEmail($uow->getScheduledEntityInsertions());
 }
 public function testHandleOnFlush()
 {
     $email = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\Email');
     $entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $uow = $this->getMockBuilder('\\Doctrine\\ORM\\UnitOfWork')->disableOriginalConstructor()->getMock();
     $entityManager->expects($this->exactly(1))->method('getUnitOfWork')->will($this->returnValue($uow));
     $uow->expects($this->once())->method('getScheduledEntityInsertions')->will($this->returnValue([$email, new \stdClass()]));
     $uow->expects($this->once())->method('getScheduledEntityUpdates')->will($this->returnValue([$email, new \stdClass()]));
     $this->manager->handleOnFlush(new OnFlushEventArgs($entityManager));
     $this->assertCount(1, $this->manager->getQueueHeadUpdate());
     $this->assertCount(1, $this->manager->getQueueThreadUpdate());
 }
Example #3
0
 /**
  * @param OnFlushEventArgs $event
  */
 public function onFlush(OnFlushEventArgs $event)
 {
     $this->emailOwnerManager->handleOnFlush($event);
     $this->emailThreadManager->handleOnFlush($event);
     $this->emailActivityManager->handleOnFlush($event);
 }