public function poll($forceFullSync = false)
    {
        /** @var PollTaskRepository $pollTaskRepository */
        $pollTaskRepository     = $this->entityManager->getRepository(PollTask::class);
        $lastSuccessfulPollTask = $pollTaskRepository->findLastSuccessfulForPoller($this->getName());

        $rootDseDnsHostName = $this->fetcher->getRootDseDnsHostName();
        $invocationId       = $this->fetcher->getInvocationId();

        $isFullSyncRequired = $this->isFullSyncRequired($forceFullSync, $lastSuccessfulPollTask, $rootDseDnsHostName, $invocationId);
        $highestCommitedUSN = $this->fetcher->getHighestCommittedUSN();

        $currentTask = $this->createCurrentPollTask(
            $invocationId,
            $highestCommitedUSN,
            $rootDseDnsHostName,
            $lastSuccessfulPollTask,
            $isFullSyncRequired
        );

        $this->entityManager->persist($currentTask);
        $this->entityManager->flush();
        try {
            if ($isFullSyncRequired) {
                $fetchedEntriesCount = $this->fullSync($currentTask, $highestCommitedUSN);
            } else {
                $usnChangedStartFrom = $lastSuccessfulPollTask->getMaxUSNChangedValue() + 1;
                $fetchedEntriesCount = $this->incrementalSync($currentTask, $usnChangedStartFrom, $highestCommitedUSN);
            }
            $currentTask->succeed($fetchedEntriesCount);

            return $fetchedEntriesCount;
        } catch (Exception $e) {
            $currentTask->fail($e->getMessage());
            throw $e;
        } finally {
            $this->entityManager->flush();
        }
    }
public function poll($forceFullSync = false)
    {
        /** @var PollTaskRepository $pollTaskRepository */
        $pollTaskRepository     = $this->entityManager->getRepository(PollTask::class);
        $lastSuccessfulPollTask = $pollTaskRepository->findLastSuccessfulForPoller($this->getName());

        $rootDseDnsHostName = $this->fetcher->getRootDseDnsHostName();
        $invocationId       = $this->fetcher->getInvocationId();

        $isFullSyncRequired = $this->isFullSyncRequired($forceFullSync, $lastSuccessfulPollTask, $rootDseDnsHostName, $invocationId);
        $highestCommitedUSN = $this->fetcher->getHighestCommittedUSN();

        $currentTask = $this->createCurrentPollTask(
            $invocationId,
            $highestCommitedUSN,
            $rootDseDnsHostName,
            $lastSuccessfulPollTask,
            $isFullSyncRequired
        );

        $this->entityManager->persist($currentTask);
        $this->entityManager->flush();
        try {
            if ($isFullSyncRequired) {
                $fetchedEntriesCount = $this->fullSync($currentTask, $highestCommitedUSN);
            } else {
                $usnChangedStartFrom = $lastSuccessfulPollTask->getMaxUSNChangedValue() + 1;
                $fetchedEntriesCount = $this->incrementalSync($currentTask, $usnChangedStartFrom, $highestCommitedUSN);
            }
            $currentTask->succeed($fetchedEntriesCount);

            return $fetchedEntriesCount;
        } catch (Exception $e) {
            $currentTask->fail($e->getMessage());
            throw $e;
        } finally {
            $this->entityManager->flush();
        }
    }
public function poll ( $ forceFullSync = false ) { /** @var PollTaskRepository $pollTaskRepository */ $ pollTaskRepository = $ this -> entityManager -> getRepository ( PollTask :: class ) ; $ lastSuccessfulPollTask = $ pollTaskRepository -> findLastSuccessfulForPoller ( $ this -> getName ( ) ) ; $ rootDseDnsHostName = $ this -> fetcher -> getRootDseDnsHostName ( ) ; $ invocationId = $ this -> fetcher -> getInvocationId ( ) ; $ isFullSyncRequired = $ this -> isFullSyncRequired ( $ forceFullSync , $ lastSuccessfulPollTask , $ rootDseDnsHostName , $ invocationId ) ; $ highestCommitedUSN = $ this -> fetcher -> getHighestCommittedUSN ( ) ; $ currentTask = $ this -> createCurrentPollTask ( $ invocationId , $ highestCommitedUSN , $ rootDseDnsHostName , $ lastSuccessfulPollTask , $ isFullSyncRequired ) ; $ this -> entityManager -> persist ( $ currentTask ) ; $ this -> entityManager -> flush ( ) ; try { if ( $ isFullSyncRequired ) { $ fetchedEntriesCount = $ this -> fullSync ( $ currentTask , $ highestCommitedUSN ) ; } else { $ usnChangedStartFrom = $ lastSuccessfulPollTask -> getMaxUSNChangedValue ( ) + 1 ; $ fetchedEntriesCount = $ this -> incrementalSync ( $ currentTask , $ usnChangedStartFrom , $ highestCommitedUSN ) ; } $ currentTask -> succeed ( $ fetchedEntriesCount ) ; return $ fetchedEntriesCount ; } catch ( Exception $ e ) { $ currentTask -> fail ( $ e -> getMessage ( ) ) ; throw $ e ; } finally { $ this -> entityManager -> flush ( ) ; } }
Make a poll request to Active Directory and return amount of processed entries

@param bool $forceFullSync force full synchronization instead of incremental one

@return integer

@throws Exception
Make a poll request to Active Directory and return amount of processed entries