BUG FIX: $basetable moved to avoid errors

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72939 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2009-03-12 00:34:32 +00:00
parent 63bd9614d5
commit 30cd13f0af

View File

@ -776,8 +776,9 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
// New records have their insert into the base data table done first, so that they can pass the
// generated primary key on to the rest of the manipulation
$baseTable = $ancestry[0];
if((!isset($this->record['ID']) || !$this->record['ID']) && isset($ancestry[0])) {
$baseTable = $ancestry[0];
DB::query("INSERT INTO \"{$baseTable}\" (\"Created\") VALUES (" . DB::getConn()->now() . ")");
$this->record['ID'] = DB::getGeneratedID($baseTable);