[limb-svn] r7019 - 3.x/trunk/limb/active_record/src

svn at limb-project.com svn at limb-project.com
Thu May 15 16:18:46 MSD 2008


Author: serega
Date: 2008-05-15 16:18:46 +0400 (Thu, 15 May 2008)
New Revision: 7019
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7019

Modified:
   3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
Log:
-- lmbActiveRecord :: $_db_conn_dsn property added that is filled in constructor. This property is used by __wakeup() method to restore the same connection as was before serialiazation.

Modified: 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php	2008-05-15 11:53:30 UTC (rev 7018)
+++ 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php	2008-05-15 12:18:46 UTC (rev 7019)
@@ -57,7 +57,13 @@
    *  @see lmbDbConnection
    */
   protected $_db_conn;
+  
   /**
+   * @var string current database connection dsn
+   */
+  protected $_db_conn_dsn; 
+  
+  /**
    * @var object lmbTableGateway instance used to access underlying db table
    */
   protected $_db_table;
@@ -204,6 +210,8 @@
     else
       $this->_db_conn = self :: getDefaultConnection();
 
+    $this->_db_conn_dsn = $this->_db_conn->getDsnString(); 
+      
     $this->_db_meta_info = lmbToolkit :: instance()->getActiveRecordMetaInfo($this, $this->_db_conn);
     $this->_db_table_fields = $this->_db_meta_info->getDbColumnsNames();
 
@@ -2168,7 +2176,7 @@
   function __wakeup()
   {
     $toolkit = lmbToolkit :: instance();
-    $this->_db_conn = $toolkit->getDbConnectionByDsn($this->_db_conn->dsn);
+    $this->_db_conn = $toolkit->getDbConnectionByDsn($this->_db_conn_dsn);
 
     $this->_db_meta_info = $toolkit->getActiveRecordMetaInfo($this, $this->_db_conn);
     $this->_db_table_fields = $this->_db_meta_info->getDbColumnsNames();
@@ -2180,8 +2188,6 @@
   
   function __sleep()
   {
-    $this->_db_conn_dsn = $this->_db_conn->getDsnString(); 
-    
     $vars = array_keys(get_object_vars($this));
     $vars = array_diff($vars, array('_db_conn', '_db_table', '_db_meta_info'));
     return $vars;



More information about the limb-svn mailing list