Skip to content

Commit

Permalink
Removed support for DateTime objects, as Elasticsearch's format of da…
Browse files Browse the repository at this point in the history
…tes is very specific and a conversion can't be handled so easy
  • Loading branch information
pmishev committed Nov 23, 2015
1 parent 8b70ab4 commit 688ff2b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
5 changes: 0 additions & 5 deletions Mapping/DocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ private function getPropertiesMetadata(\ReflectionClass $documentReflection)
'type' => $propertyAnnotation->type,
];

// If property is date and a custom format is set
if (isset($propertyAnnotation->options['format'])) {
$propertyMetadata[$propertyAnnotation->name]['format'] = $propertyAnnotation->options['format'];
}

// If property is multilanguage
if ($propertyAnnotation instanceof MLProperty) {
$propertyMetadata[$propertyAnnotation->name]['multilanguage'] = true;
Expand Down
9 changes: 0 additions & 9 deletions Result/DocumentConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ public function assignArrayToObject(array $array, ObjectInterface $object, array
);
}

} elseif ($propertyMetadata['type'] === 'date') {
$objectValue = \DateTime::createFromFormat(
isset($propertyMetadata['format']) ? $propertyMetadata['format'] : \DateTime::ISO8601,
$array[$esField]
);

} else {
$objectValue = $array[$esField];
}
Expand Down Expand Up @@ -190,9 +184,6 @@ public function convertToArray(ObjectInterface $object, $propertiesMetadata = []
$array[$name . $this->languageSeparator . $language] = $langValue;
}

} elseif ($value instanceof \DateTime) {
$array[$name] = $value->format(isset($propertyMetadata['format']) ? $propertyMetadata['format'] : \DateTime::ISO8601);

} else {
$array[$name] = $value;
}
Expand Down

0 comments on commit 688ff2b

Please sign in to comment.