/** * @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 testHandleOnFlushWithoutNewEmails() { $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $uow = $this->getMockBuilder('\\Doctrine\\ORM\\UnitOfWork')->disableOriginalConstructor()->getMock(); $em->expects($this->once())->method('getUnitOfWork')->will($this->returnValue($uow)); $uow->expects($this->once())->method('getScheduledEntityInsertions')->will($this->returnValue([new \stdClass()])); $uow->expects($this->never())->method('computeChangeSet'); $this->manager->handleOnFlush(new OnFlushEventArgs($em)); }
/** * @param OnFlushEventArgs $event */ public function onFlush(OnFlushEventArgs $event) { $this->emailOwnerManager->handleOnFlush($event); $this->emailThreadManager->handleOnFlush($event); $this->emailActivityManager->handleOnFlush($event); }