Skip to content

Change Object Parent / Key without Flushing Saved but Unpublished Changes #16962

Discussion options

You must be logged in to vote

This version date is based on the modification date. The reason why it does not work is that the modification date only is set as dirty when it actually changes:

https://github.com/pimcore/pimcore/blob/11.x/models/Element/AbstractElement.php#L162

All of this seems to be really some kind of hack, but if you would like to achieve that the published checkbox is still there, you would need something like this:

$object = DataObject\AbstractObject::getById($object->getId(), true);

$parentId = $parentObject->getId();
$object->setParentId($parentId);
$object->setKey($key);
$modificationDate = $object->getModificationDate();
$object->setModificationDate(0);
$object->setModificationDate($modificat…

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
14 replies
@markus-moser
Comment options

@cancan101
Comment options

@cancan101
Comment options

@markus-moser
Comment options

Answer selected by cancan101
@cancan101
Comment options

@markus-moser
Comment options

@cancan101
Comment options

@markus-moser
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants