Merge pull request #613 from silverstripe-rebelalliance/trac/7598

BUG $db in extensions not inited early enough (#7598)
This commit is contained in:
Sam Minnée 2012-07-02 19:33:54 -07:00
commit 9c57294aa9

View File

@ -295,6 +295,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* don't have their defaults set. * don't have their defaults set.
*/ */
function __construct($record = null, $isSingleton = false, $model = null) { function __construct($record = null, $isSingleton = false, $model = null) {
parent::__construct();
// Set the fields data. // Set the fields data.
if(!$record) { if(!$record) {
$record = array( $record = array(
@ -345,8 +348,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
HTTP::register_modification_date($record['LastEdited']); HTTP::register_modification_date($record['LastEdited']);
} }
parent::__construct();
// Must be called after parent constructor // Must be called after parent constructor
if(!$isSingleton && (!isset($this->record['ID']) || !$this->record['ID'])) { if(!$isSingleton && (!isset($this->record['ID']) || !$this->record['ID'])) {
$this->populateDefaults(); $this->populateDefaults();