Merge branch '0.4' into 1

This commit is contained in:
github-actions 2023-11-12 21:54:16 +00:00
commit 8cb3a2dd24
2 changed files with 10 additions and 14 deletions

View File

@ -13,6 +13,7 @@ use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Versioned;
use RelationFieldsTestPage;
use GridFieldTestPage;
use SilverStripe\Forms\RequiredFields;
/**
*
@ -100,15 +101,11 @@ class Company extends DataObject
return $fields;
}
public function validate()
public function getCMSValidator()
{
$result = parent::validate();
if (!$this->Name) {
$result->addFieldError('Name', 'Name is required');
}
return $result;
return new RequiredFields(
['Name']
);
}
public function DynamicProperty()

View File

@ -5,6 +5,7 @@ namespace SilverStripe\FrameworkTest\Model;
use SilverStripe\Assets\Image;
use SilverStripe\Forms\EmailField;
use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\Connect\MySQLSchemaManager;
use SilverStripe\ORM\DataObject;
@ -141,13 +142,11 @@ class Employee extends DataObject
srand();
}
public function validate()
public function getCMSValidator()
{
$result = parent::validate();
if (!$this->Name) {
$result->addFieldError('Name', '"Name" can\'t be blank');
}
return $result;
return new RequiredFields(
['Name']
);
}
/**