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 SilverStripe\Versioned\Versioned;
|
||||||
use RelationFieldsTestPage;
|
use RelationFieldsTestPage;
|
||||||
use GridFieldTestPage;
|
use GridFieldTestPage;
|
||||||
|
use SilverStripe\Forms\RequiredFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -100,15 +101,11 @@ class Company extends DataObject
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate()
|
public function getCMSValidator()
|
||||||
{
|
{
|
||||||
$result = parent::validate();
|
return new RequiredFields(
|
||||||
|
['Name']
|
||||||
if (!$this->Name) {
|
);
|
||||||
$result->addFieldError('Name', 'Name is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DynamicProperty()
|
public function DynamicProperty()
|
||||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\FrameworkTest\Model;
|
|||||||
use SilverStripe\Assets\Image;
|
use SilverStripe\Assets\Image;
|
||||||
use SilverStripe\Forms\EmailField;
|
use SilverStripe\Forms\EmailField;
|
||||||
use SilverStripe\Forms\NumericField;
|
use SilverStripe\Forms\NumericField;
|
||||||
|
use SilverStripe\Forms\RequiredFields;
|
||||||
use SilverStripe\Forms\TextField;
|
use SilverStripe\Forms\TextField;
|
||||||
use SilverStripe\ORM\Connect\MySQLSchemaManager;
|
use SilverStripe\ORM\Connect\MySQLSchemaManager;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
@ -141,13 +142,11 @@ class Employee extends DataObject
|
|||||||
srand();
|
srand();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate()
|
public function getCMSValidator()
|
||||||
{
|
{
|
||||||
$result = parent::validate();
|
return new RequiredFields(
|
||||||
if (!$this->Name) {
|
['Name']
|
||||||
$result->addFieldError('Name', '"Name" can\'t be blank');
|
);
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user