mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-04 23:28:41 +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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function custom_database_fields($class) {
|
public static function custom_database_fields($class) {
|
||||||
// Ensure that statics are loaded from the decorators
|
|
||||||
singleton($class);
|
|
||||||
|
|
||||||
$fields = Object::uninherited_static($class, 'db');
|
$fields = Object::uninherited_static($class, 'db');
|
||||||
$hasOne = Object::uninherited_static($class, 'has_one');
|
$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])) {
|
if(isset($isNewRecord) && $isNewRecord && isset($manipulation[$baseTable])) {
|
||||||
$manipulation[$baseTable]['command'] = 'update';
|
$manipulation[$baseTable]['command'] = 'update';
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::manipulate($manipulation);
|
DB::manipulate($manipulation);
|
||||||
|
|
||||||
if(isset($isNewRecord) && $isNewRecord) {
|
if(isset($isNewRecord) && $isNewRecord) {
|
||||||
@ -2051,13 +2049,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_own_table($dataClass) {
|
public function has_own_table($dataClass) {
|
||||||
|
|
||||||
// The condition below has the same effect as !is_subclass_of($dataClass,'DataObject'),
|
// 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
|
// 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;
|
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(!isset(self::$cache_has_own_table[$dataClass])) {
|
||||||
if(get_parent_class($dataClass) == 'DataObject') {
|
if(get_parent_class($dataClass) == 'DataObject') {
|
||||||
self::$cache_has_own_table[$dataClass] = true;
|
self::$cache_has_own_table[$dataClass] = true;
|
||||||
@ -2579,6 +2575,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('augmentSQL', $query);
|
$this->extend('augmentSQL', $query);
|
||||||
|
|
||||||
$records = $query->execute();
|
$records = $query->execute();
|
||||||
$records->rewind();
|
$records->rewind();
|
||||||
$record = $records->current();
|
$record = $records->current();
|
||||||
|
Loading…
Reference in New Issue
Block a user