mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
cf5afb4018
commit
8f8a3b2f6e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user