Skip to content

Commit

Permalink
Update src/GraphQL/DataObjectType/PimcoreObjectType.php
Browse files Browse the repository at this point in the history
  • Loading branch information
leitge authored Feb 24, 2024
1 parent e6badf4 commit e846205
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/GraphQL/DataObjectType/PimcoreObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit e846205

Please sign in to comment.