BUGFIX Reverted special cases for Translatable in Versioned->canBeVersioned() (originally committed in r42119) - was checking for existence of underscores in table names as an indication of the "_lang" suffix, which is no longer needed. It was also a flawed assumption which tripped over classes like TranslatableTest_TestPage

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@70318 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-01-18 22:46:16 +00:00
parent e39f4f747a
commit 33066bffda

View File

@ -329,22 +329,8 @@ class Versioned extends DataObjectDecorator {
* @return boolean
*/
function canBeVersioned($table) {
$tableParts = explode('_',$table);
$dbFields = singleton($tableParts[0])->databaseFields();
if (!ClassInfo::exists( $tableParts[0] ) || !is_subclass_of( $tableParts[0], 'DataObject' ) || empty( $dbFields )){
return false;
} else if (count($tableParts)>1) {
foreach (Versioned::$versionableExtensions as $versionableExtension => $suffixes) {
if ($this->owner->hasExtension($versionableExtension)) {
foreach ((array)$suffixes as $suffix) {
if ($part = array_search($suffix,$tableParts)) unset($tableParts[$part]);
}
}
}
if (count($tableParts)>1) return false;
}
return true;
$dbFields = singleton($table)->databaseFields();
return !(!ClassInfo::exists($table) || !is_subclass_of($table, 'DataObject' ) || empty( $dbFields ));
}
/**