Throw a more meaningful error when the number of items retrieved by Doctrine is less than the number of items from ElasticSearch.
This commit is contained in:
parent
02009c28b0
commit
68e73366d9
|
@ -5,6 +5,7 @@ namespace FOQ\ElasticaBundle\Doctrine;
|
|||
use FOQ\ElasticaBundle\HybridResult;
|
||||
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
|
||||
use Elastica_Document;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Maps Elastica documents with Doctrine objects
|
||||
|
@ -89,6 +90,9 @@ abstract class AbstractElasticaToModelTransformer implements ElasticaToModelTran
|
|||
public function hybridTransform(array $elasticaObjects)
|
||||
{
|
||||
$objects = $this->transform($elasticaObjects);
|
||||
if (count($objects) < count($elasticaObjects)) {
|
||||
throw new RuntimeException('Cannot transform all Elastica results into objects.');
|
||||
};
|
||||
|
||||
$result = array();
|
||||
for ($i = 0; $i < count($elasticaObjects); $i++) {
|
||||
|
|
Loading…
Reference in a new issue