BUGFIX YamlFixture::writeDataObject() - some databases need special allowance to edit the primary key column - do so by using DB::getConn()->allowPrimaryKeyEditing() (from r100393)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105558 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-05-25 03:49:22 +00:00
parent cf5afb4018
commit 8f8a3b2f6e

View File

@ -180,7 +180,12 @@ class YamlFixture extends Object {
// Call $this->write(). (For example, in FileTest)
if(isset($fields['ID'])) {
$obj->ID = $fields['ID'];
// The database needs to allow inserting values into the foreign key column (ID in our case)
$conn = DB::getConn();
if(method_exists($conn, 'allowPrimaryKeyEditing')) $conn->allowPrimaryKeyEditing($dataClass, true);
$obj->write(false, true);
if(method_exists($conn, 'allowPrimaryKeyEditing')) $conn->allowPrimaryKeyEditing($dataClass, false);
}
// Populate the dictionary with the ID