diff --git a/Transformer/ModelToElasticaAutoTransformer.php b/Transformer/ModelToElasticaAutoTransformer.php index 172d31d..cc76e8f 100644 --- a/Transformer/ModelToElasticaAutoTransformer.php +++ b/Transformer/ModelToElasticaAutoTransformer.php @@ -45,7 +45,7 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf $document = new \Elastica_Document($identifier); foreach ($fields as $key => $mapping) { $property = new PropertyPath($key); - if (!empty($mapping['_parent'])) { + if (!empty($mapping['_parent']) && $mapping['_parent'] !== '~') { $parent = $property->getValue($object); $identifierProperty = new PropertyPath($mapping['_parent']['identifier']); $document->setParent($identifierProperty->getValue($parent));