mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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
This commit is contained in:
parent
838b6f3785
commit
173711531e
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user