[Solar-svn] Revision 3105
pmjones at solarphp.com
pmjones at solarphp.com
Sat Apr 12 08:11:06 CDT 2008
Solar_Sql_Model: [FIX] Method insert() now sets the record ID so that refresh() will work as expected. Thanks for the report, Jeff Surgeson.
Modified: trunk/Solar/Sql/Model.php
===================================================================
--- trunk/Solar/Sql/Model.php 2008-04-12 01:54:54 UTC (rev 3104)
+++ trunk/Solar/Sql/Model.php 2008-04-12 13:11:06 UTC (rev 3105)
@@ -1646,10 +1646,14 @@
*/
// no exception thrown, so it must have worked.
// if there was an autoincrement column, set its value in the data.
+ $id = $this->_sql->lastInsertId($this->_table_name, $key);
foreach ($this->_table_cols as $key => $val) {
if ($val['autoinc']) {
// set the value and leave the loop (should be only one)
- $data[$key] = $this->_sql->lastInsertId($this->_table_name, $key);
+ $data[$key] = $id;
+ if ($spec instanceof Solar_Sql_Model_Record) {
+ $spec->$key = $id;
+ }
break;
}
}
More information about the Solar-svn
mailing list