public function testAnyNotLinked() { $this->processor1->expects($this->any())->method('supports')->will($this->returnValue(true)); $this->processor1->expects($this->any())->method('isLinked')->will($this->returnValue(true)); $this->processor2->expects($this->any())->method('supports')->will($this->returnValue(true)); $this->processor2->expects($this->any())->method('isLinked')->will($this->returnValue(false)); $this->assertFalse($this->delegate->isLinked(new SourceMock(123))); }
/** * @param OnFlushEventArgs $args */ public function onFlush(OnFlushEventArgs $args) { $uow = $args->getEntityManager()->getUnitOfWork(); $entities = array_merge($uow->getScheduledEntityInsertions(), $uow->getScheduledEntityUpdates()); // remember sources that are to be updated foreach ($entities as $entity) { if (!$entity instanceof SourceInterface) { continue; } $modified = $this->isSourceModified($entity, $uow); // update modification date when it's modified if ($modified) { $this->setSourceModificationDate($entity, $uow); } if ($modified || !$this->sourceProcessor->isLinked($entity)) { $this->sources[] = $entity; } } }