From 173711531e107c9ec77b72638b99f69e86d1112c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 28 May 2009 23:18:01 +0000 Subject: [PATCH] MINOR Reverted r77823, it causes infinite loops whenver DataObject->getField() etc. are used within __construct(). This is the case with Translatable and other modules, and breaks things like schema building git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78121 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObject.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 27f6572e5..5833d80b7 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -188,9 +188,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return array */ public static function custom_database_fields($class) { - // Ensure that statics are loaded from the decorators - singleton($class); - $fields = Object::uninherited_static($class, 'db'); $hasOne = Object::uninherited_static($class, 'has_one'); @@ -920,6 +917,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity if(isset($isNewRecord) && $isNewRecord && isset($manipulation[$baseTable])) { $manipulation[$baseTable]['command'] = 'update'; } + DB::manipulate($manipulation); if(isset($isNewRecord) && $isNewRecord) { @@ -2051,12 +2049,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * @return bool */ public function has_own_table($dataClass) { + // The condition below has the same effect as !is_subclass_of($dataClass,'DataObject'), // which causes PHP < 5.3 to segfault in rare circumstances, see PHP bug #46753 if($dataClass == 'DataObject' || !in_array('DataObject', ClassInfo::ancestry($dataClass))) return false; - - // Ensure that statics are loaded from the decorators - singleton($dataClass); if(!isset(self::$cache_has_own_table[$dataClass])) { if(get_parent_class($dataClass) == 'DataObject') { @@ -2579,6 +2575,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity } $this->extend('augmentSQL', $query); + $records = $query->execute(); $records->rewind(); $record = $records->current();