Fixed normalizing values twice in transfomer
This commit is contained in:
parent
a81d878d93
commit
4baefe6686
|
@ -49,8 +49,8 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf
|
|||
if (!method_exists($class, $getter)) {
|
||||
throw new RuntimeException(sprintf('The getter %s::%s does not exist', $class, $getter));
|
||||
}
|
||||
if ($value = $this->normalizeValue($object->$getter()) !== null) {
|
||||
$array[$key] = $this->normalizeValue($object->$getter());
|
||||
if (null !== $value = $this->normalizeValue($object->$getter())) {
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
$identifierGetter = 'get'.ucfirst($this->options['identifier']);
|
||||
|
@ -71,7 +71,7 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf
|
|||
$normalizeValue = function(&$v) {
|
||||
if ($v instanceof \DateTime) {
|
||||
$v = (int) $v->format('U');
|
||||
} elseif (!is_int($v) && !is_float($v) && !is_bool($v) && !is_null($v)) {
|
||||
} elseif (!is_scalar($v) && !is_null($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue