Skip to content

Commit 8b94c5a

Browse files
authored
Merge pull request #1799 from deguif/merge-isset
Merge isset() calls
2 parents a888b84 + 9559841 commit 8b94c5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Transformer/ModelToElasticaAutoTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ protected function transformObjectToDocument(object $object, array $fields, stri
149149
}
150150
$value = $this->propertyAccessor->getValue($object, $path);
151151

152-
if (isset($mapping['type'])
152+
if (isset($mapping['properties'], $mapping['type'])
153+
&& $mapping['properties']
153154
&& \in_array($mapping['type'], ['nested', 'object'], true)
154-
&& isset($mapping['properties']) && !empty($mapping['properties'])
155155
) {
156156
/* $value is a nested document or object. Transform $value into
157157
* an array of documents, respective the mapped properties.
@@ -161,7 +161,7 @@ protected function transformObjectToDocument(object $object, array $fields, stri
161161
continue;
162162
}
163163

164-
if (isset($mapping['type']) && 'attachment' == $mapping['type']) {
164+
if ('attachment' === ($mapping['type'] ?? null)) {
165165
// $value is an attachment. Add it to the document.
166166
if ($value instanceof \SplFileInfo) {
167167
$document->addFile($key, $value->getPathName());

0 commit comments

Comments
 (0)