summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php3
-rw-r--r--framework/Data/SqlMap/Configuration/TParameterProperty.php12
-rw-r--r--framework/Data/SqlMap/Configuration/TResultProperty.php16
-rw-r--r--framework/Data/SqlMap/Configuration/TSqlMapStatement.php6
-rw-r--r--framework/Data/TDbCommand.php3
-rw-r--r--framework/Data/TDbConnection.php4
-rw-r--r--framework/TComponent.php25
7 files changed, 63 insertions, 6 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php
index 3bbc2dbc..6a709162 100644
--- a/framework/Data/ActiveRecord/TActiveRecord.php
+++ b/framework/Data/ActiveRecord/TActiveRecord.php
@@ -203,8 +203,7 @@ abstract class TActiveRecord extends TComponent
*/
public function __sleep()
{
- $this->_connection=null;
- return array_keys(get_object_vars($this));
+ return array_diff(parent::__sleep(),array("\0*\0_connection"));
}
/**
diff --git a/framework/Data/SqlMap/Configuration/TParameterProperty.php b/framework/Data/SqlMap/Configuration/TParameterProperty.php
index de879c4b..961bfecc 100644
--- a/framework/Data/SqlMap/Configuration/TParameterProperty.php
+++ b/framework/Data/SqlMap/Configuration/TParameterProperty.php
@@ -134,5 +134,17 @@ class TParameterProperty extends TComponent
{
$this->_nullValue = $value;
}
+
+ public function __sleep()
+ {
+ $exprops = array(); $cn = 'TParameterProperty';
+ if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler";
+ if ($this->_type===null) $exprops[] = "\0$cn\0_type";
+ if ($this->_column===null) $exprops[] = "\0$cn\0_column";
+ if ($this->_dbType===null) $exprops[] = "\0$cn\0_dbType";
+ if ($this->_property===null) $exprops[] = "\0$cn\0_property";
+ if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue";
+ return array_diff(parent::__sleep(),$exprops);
+ }
}
diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php
index ce32a17d..8d146e66 100644
--- a/framework/Data/SqlMap/Configuration/TResultProperty.php
+++ b/framework/Data/SqlMap/Configuration/TResultProperty.php
@@ -324,5 +324,21 @@ class TResultProperty extends TComponent
}
return $this->getPropertyValueType() == self::ARRAY_TYPE;
}
+
+ public function __sleep()
+ {
+ $exprops = array(); $cn = 'TResultProperty';
+ if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue";
+ if ($this->_propertyName===null) $exprops[] = "\0$cn\0_propertyNama";
+ if ($this->_columnName===null) $exprops[] = "\0$cn\0_columnName";
+ if ($this->_columnIndex==-1) $exprops[] = "\0$cn\0_columnIndex";
+ if ($this->_nestedResultMapName===null) $exprops[] = "\0$cn\0_nestedResultMapName";
+ if ($this->_nestedResultMap===null) $exprops[] = "\0$cn\0_nestedResultMap";
+ if ($this->_valueType===null) $exprops[] = "\0$cn\0_valueType";
+ if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler";
+ if ($this->_isLazyLoad===false) $exprops[] = "\0$cn\0_isLazyLoad";
+ if ($this->_select===null) $exprops[] = "\0$cn\0_select";
+ return array_diff(parent::__sleep(),$exprops);
+ }
}
diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php
index 0648d67c..3a62cbed 100644
--- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php
+++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php
@@ -292,6 +292,12 @@ class TSqlMapStatement extends TComponent
if(strlen($type= $this->getResultClass()) > 0)
return $this->createInstanceOf($registry,$type,$row);
}
+
+ public function __sleep()
+ {
+ return array_diff(parent::__sleep(),array("\0TSqlMapStatement\0_resultMap"));
+ }
+
}
/**
diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php
index 606099d4..937a44ff 100644
--- a/framework/Data/TDbCommand.php
+++ b/framework/Data/TDbCommand.php
@@ -58,8 +58,7 @@ class TDbCommand extends TComponent
*/
public function __sleep()
{
- $this->_statement=null;
- return array_keys(get_object_vars($this));
+ return array_diff(parent::__sleep(),array("\0TDbCommand\0_statement"));
}
/**
diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php
index 01cacce2..69420ea1 100644
--- a/framework/Data/TDbConnection.php
+++ b/framework/Data/TDbConnection.php
@@ -130,8 +130,8 @@ class TDbConnection extends TComponent
*/
public function __sleep()
{
- $this->close();
- return array_keys(get_object_vars($this));
+// $this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session
+ return array_diff(parent::__sleep(),array("\0TDbConnection\0_pdo","\0TDbConnection\0_active"));
}
/**
diff --git a/framework/TComponent.php b/framework/TComponent.php
index ea204011..dbcf4a60 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -451,6 +451,31 @@ class TComponent
public function addParsedObject($object)
{
}
+
+ /**
+ * Do not call this method. This is a PHP magic method that will be called automatically
+ * after any unserialization; it can perform reinitialization tasks on the object.
+ */
+ public function __wakeup()
+ {
+ if ($this->_e===null)
+ $this->_e = array();
+ }
+
+ /**
+ * Returns an array with the names of all variables of that object that should be serialized.
+ * Do not call this method. This is a PHP magic method that will be called automatically
+ * prior to any serialization.
+ */
+ public function __sleep()
+ {
+ $a = (array)$this;
+ $a = array_keys($a);
+ $exprops = array();
+ if ($this->_e===array())
+ $exprops[] = "\0TComponent\0_e";
+ return array_diff($a,$exprops);
+ }
}
/**