mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Resolve merge regressions
This commit is contained in:
parent
3b0a9f4ba2
commit
4f1f2497be
@ -122,10 +122,10 @@ class DBClassName extends Enum {
|
||||
return $class;
|
||||
}
|
||||
// If there is no class for this table, strip table modifiers (_Live / _versions) off the end
|
||||
if(preg_match('/^(?<class>.+)(_[^_]+)$/i', $this->getTable(), $matches)) {
|
||||
if(preg_match('/^(?<class>.+)(_[^_]+)$/i', $table, $matches)) {
|
||||
return $this->getClassNameFromTable($matches['class']);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -162,12 +162,12 @@ class DBClassName extends Enum {
|
||||
if(empty(self::$classname_cache[$table])) {
|
||||
self::$classname_cache[$table] = array();
|
||||
}
|
||||
|
||||
|
||||
// Check existing cache
|
||||
if(!empty(self::$classname_cache[$table][$name])) {
|
||||
return self::$classname_cache[$table][$name];
|
||||
}
|
||||
|
||||
|
||||
// Get all class names
|
||||
$classNames = $this->getEnum();
|
||||
if(DB::get_schema()->hasField($table, $name)) {
|
||||
@ -201,7 +201,7 @@ class DBClassName extends Enum {
|
||||
if($defaultClass && class_exists($defaultClass)) {
|
||||
return $defaultClass;
|
||||
}
|
||||
|
||||
|
||||
// Fallback to first option
|
||||
$enum = $this->getEnum();
|
||||
return reset($enum);
|
||||
|
@ -1167,12 +1167,13 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
|
||||
$oldMode = Versioned::get_reading_mode();
|
||||
Versioned::reading_stage($toStage);
|
||||
|
||||
// Migrate stage prior to write
|
||||
$from->setSourceQueryParam('Versioned.mode', 'stage');
|
||||
$from->setSourceQueryParam('Versioned.stage', $toStage);
|
||||
|
||||
$conn = DB::get_conn();
|
||||
if(method_exists($conn, 'allowPrimaryKeyEditing')) {
|
||||
$conn = DB::get_conn();
|
||||
$conn->allowPrimaryKeyEditing($baseClass, true);
|
||||
// Migrate stage prior to write
|
||||
$from->setSourceQueryParam('Versioned.mode', 'stage');
|
||||
$from->setSourceQueryParam('Versioned.stage', $toStage);
|
||||
$from->write();
|
||||
$conn->allowPrimaryKeyEditing($baseClass, false);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user