Add deprecation notice for 4.6 and update docs

This commit is contained in:
cpenny 2020-02-19 11:56:10 +13:00
parent f977f9734c
commit 11e2005b9b
2 changed files with 9 additions and 3 deletions

View File

@ -274,9 +274,10 @@ class MyController extends Controller
### Validation in the CMS ### Validation in the CMS
In the CMS, we're not creating the forms for editing CMS records. The `Form` instance is generated for us so we cannot In the CMS, we're not creating the forms for editing CMS records. The `Form` instance is generated for us so we cannot
call `setValidator` easily. However, a `DataObject` can provide its' own `Validator` instance through the call `setValidator` easily. However, a `DataObject` can provide its' own `Validator` instance/s through the
`getCMSValidator()` method. The CMS interfaces such as [LeftAndMain](api:SilverStripe\Admin\LeftAndMain), [ModelAdmin](api:SilverStripe\Admin\ModelAdmin) and [GridField](api:SilverStripe\Forms\GridField\GridField) will `getValidatorList()` method. The CMS interfaces such as [LeftAndMain](api:SilverStripe\Admin\LeftAndMain),
respect the provided `Validator` and handle displaying error and success responses to the user. [ModelAdmin](api:SilverStripe\Admin\ModelAdmin) and [GridField](api:SilverStripe\Forms\GridField\GridField) will
respect the provided `Validator`/s and handle displaying error and success responses to the user.
[info] [info]
Again, custom error messages can be provided through the `FormField` Again, custom error messages can be provided through the `FormField`

View File

@ -2457,6 +2457,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Support for the old method during the deprecation period // Support for the old method during the deprecation period
if ($this->hasMethod('getCMSValidator')) { if ($this->hasMethod('getCMSValidator')) {
Deprecation::notice(
'4.6',
'getCMSValidator() is removed in 5.0 in favour of getValidatorList()'
);
$validatorList->addValidator($this->getCMSValidator()); $validatorList->addValidator($this->getCMSValidator());
} }