This commit is contained in:
Jackson Darlow 2024-03-21 05:30:34 +13:00 committed by GitHub
commit a9347fbe62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable;
use SilverStripe\Dev\Debug;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormField;
use SilverStripe\Forms\FormScaffolder;
@ -3627,6 +3628,17 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
);
}
// Sanity check for fields that conflict with parent
foreach (array_keys($fields) as $fieldName) {
if (method_exists(get_parent_class($this), $fieldName) && !($this instanceof TestOnly)) {
throw new LogicException(sprintf(
'\'%s\' has a $db field named "%s" that coincides with an inherited method of the same name.',
static::class,
$fieldName
));
}
}
if ($fields) {
$hasAutoIncPK = get_parent_class($this ?? '') === self::class;
DB::require_table(