mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Merge branch '0.4' into 1
This commit is contained in:
commit
8cb3a2dd24
@ -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()
|
||||
|
@ -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']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user