mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Compare commits
2 Commits
4d5a5a15a2
...
211c9cb246
Author | SHA1 | Date | |
---|---|---|---|
|
211c9cb246 | ||
|
4631aa0067 |
@ -3285,9 +3285,6 @@ class DataObject extends ModelData implements DataObjectInterface, i18nEntityPro
|
||||
/** @var DBField $obj */
|
||||
$table = $schema->tableName($class);
|
||||
$obj = Injector::inst()->create($spec, $fieldName);
|
||||
if (is_null($value)) {
|
||||
$value = $obj->getDefaultValue();
|
||||
}
|
||||
$obj->setTable($table);
|
||||
$obj->setValue($value, $this, false);
|
||||
return $obj;
|
||||
|
@ -52,9 +52,10 @@ class DBDatetime extends DBDate implements TemplateGlobalProvider
|
||||
public const ISO_DATETIME_NORMALISED = 'y-MM-dd\'T\'HH:mm:ss';
|
||||
|
||||
private static array $field_validators = [
|
||||
DatetimeFieldValidator::class,
|
||||
// disable parent validator
|
||||
// Remove parent validator
|
||||
DateFieldValidator::class => null,
|
||||
// Add datetime validator
|
||||
DatetimeFieldValidator::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -111,7 +111,7 @@ class DBDecimal extends DBField
|
||||
->setScale($this->decimalSize);
|
||||
}
|
||||
|
||||
public function nullValue(): int
|
||||
public function nullValue(): float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ use SilverStripe\Forms\EmailField;
|
||||
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||
use SilverStripe\Core\Validation\FieldValidation\EmailFieldValidator;
|
||||
use SilverStripe\Forms\FormField;
|
||||
use SilverStripe\Forms\NullableField;
|
||||
|
||||
class DBEmail extends DBVarchar
|
||||
{
|
||||
@ -16,14 +15,8 @@ class DBEmail extends DBVarchar
|
||||
|
||||
public function scaffoldFormField(?string $title = null, array $params = []): ?FormField
|
||||
{
|
||||
// Set field with appropriate size
|
||||
$field = EmailField::create($this->name, $title);
|
||||
$field->setMaxLength($this->getSize());
|
||||
|
||||
// Allow the user to select if it's null instead of automatically assuming empty string is
|
||||
if (!$this->getNullifyEmpty()) {
|
||||
return NullableField::create($field);
|
||||
}
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user