diff --git a/src/GraphQL/DataObjectType/PimcoreObjectType.php b/src/GraphQL/DataObjectType/PimcoreObjectType.php index 182eedfb..851afefb 100644 --- a/src/GraphQL/DataObjectType/PimcoreObjectType.php +++ b/src/GraphQL/DataObjectType/PimcoreObjectType.php @@ -88,9 +88,10 @@ public function build($context = []) 'resolve' => function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) { $object = \Pimcore\Model\DataObject::getById($value['id']); if ($object) { - $version = $object->getVersions()[count($object->getVersions()) - 1]->getId(); - if ($version) { - return $version; + foreach (array_reverse($object->getVersions()) as $version) { + if ($object->getModificationDate() === $version->getDate()) { + return $version->getId(); + } } }