Getting Unpublished Version of Object #17056
Unanswered
cancan101
asked this question in
Q&A / Support
Replies: 1 comment 3 replies
-
I believe this works, though not sure if there are any gotchas I should be aware of: $user = \Pimcore\Tool\Admin::getCurrentUser();
$latestVersion = $myObject->getLatestVersion($user?->getId());
if ($latestVersion) {
$latestObj = $latestVersion->loadData();
if ($latestObj instanceof \Pimcore\Model\DataObject\MyObject) {
$myObject = $latestObj;
}
} took inspiration from: https://github.com/pimcore/admin-ui-classic-bundle/blob/d191bcd0184f77e3ac9d25270ee02a4fcc2496aa/src/Controller/Admin/DataObject/DataObjectController.php#L2025-L2038 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do I get the current version of an Object, including any unpublished changes?
returns the DB version.
/CC @markus-moser (related to https://github.com/orgs/pimcore/discussions/16962)
Beta Was this translation helpful? Give feedback.
All reactions