public function __sleep()
{
foreach ($this->_related as $field => $object) {
if ($object instanceof Database_Result) {
if ($object instanceof Database_Result_Cached) {
continue;
}
// Convert result object to cached result to allow for serialization
// Currently no way to get the $_query property form the result to pass to the cached result
// @see http://dev.kohanaphp.com/issues/2297
$this->_related[$field] = new Database_Result_Cached($object->as_array(), '');
}
}
// Return array of all properties to get them serialised
$props = array();
foreach ($this as $prop => $val) {
$props[] = $prop;
}
return $props;
}