public function __sleep()
{
$finalVars = [];
$parentVars = parent::__sleep();
if (isset($this->_fulldump)) {
// this is if we want to make a full dump of the object (eg. for a new version), including childs for recyclebin
$blockedVars = ["dependencies", "userPermissions", "hasChilds", "versions", "scheduledTasks", "parent"];
$finalVars[] = "_fulldump";
$this->removeInheritedProperties();
} else {
// this is if we want to cache the object
$blockedVars = ["dependencies", "userPermissions", "childs", "hasChilds", "versions", "scheduledTasks", "properties", "parent"];
}
foreach ($parentVars as $key) {
if (!in_array($key, $blockedVars)) {
$finalVars[] = $key;
}
}
return $finalVars;
}