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 = ["o_userPermissions", "o_dependencies", "o_hasChilds", "o_versions", "o_class", "scheduledTasks", "o_parent", "omitMandatoryCheck"];
$finalVars[] = "_fulldump";
$this->removeInheritedProperties();
} else {
// this is if we want to cache the object
$blockedVars = ["o_userPermissions", "o_dependencies", "o_childs", "o_hasChilds", "o_versions", "o_class", "scheduledTasks", "o_properties", "o_parent", "o___loadedLazyFields", "omitMandatoryCheck"];
}
foreach ($parentVars as $key) {
if (!in_array($key, $blockedVars)) {
$finalVars[] = $key;
}
}
return $finalVars;
}