Move more inconsistent code to mongodb and orm implementations

This commit is contained in:
ornicar 2011-05-09 10:56:27 -07:00
commit 05ab288051
3 changed files with 43 additions and 1 deletions

View file

@ -44,7 +44,7 @@ abstract class AbstractDoctrineProvider implements ProviderInterface
$stepStartTime = microtime(true);
$documents = array();
$objects = $queryBuilder->limit($this->options['batch_size'])->skip($offset)->getQuery()->execute()->toArray();
$objects = $this->fetchSlice($queryBuilder, $this->options['batch_size'], $offset);
foreach ($objects as $object) {
try {
@ -69,10 +69,21 @@ abstract class AbstractDoctrineProvider implements ProviderInterface
/**
* Counts the objects of a query builder
*
* @param queryBuilder
* @return int
**/
protected abstract function countObjects($queryBuilder);
/**
* Fetches a slice of objects
*
* @param queryBuilder
* @param int limit
* @param int offset
* @return array of objects
**/
protected abstract function fetchSlice($queryBuilder, $limit, $offset);
/**
* Creates the query buider used to fetch the documents to index
*