diff --git a/en/02_Developer_Guides/00_Model/09_Validation.md b/en/02_Developer_Guides/00_Model/09_Validation.md index 12730e04..57ce8d52 100644 --- a/en/02_Developer_Guides/00_Model/09_Validation.md +++ b/en/02_Developer_Guides/00_Model/09_Validation.md @@ -49,6 +49,7 @@ The return value of `validate()` is a [`ValidationResult`](api:SilverStripe\Core ```php namespace App\Model; +use SilverStripe\Core\Validation\ValidationResult; use SilverStripe\ORM\DataObject; class MyObject extends DataObject @@ -58,7 +59,7 @@ class MyObject extends DataObject 'Postcode' => 'Varchar', ]; - public function validate() + public function validate(): ValidationResult { $result = parent::validate(); diff --git a/en/08_Changelogs/6.0.0.md b/en/08_Changelogs/6.0.0.md index 03f46aae..7d50ddbe 100644 --- a/en/08_Changelogs/6.0.0.md +++ b/en/08_Changelogs/6.0.0.md @@ -1042,6 +1042,7 @@ As part of these changes [`ArrayList::find()`](api:SilverStripe\Model\List\Array ### General changes {#api-general} +- [`DataObject::validate()`](api:SilverStripe\ORM\DataObject::validate()) now has an explicit `ValidationResult` return type. - [`DataObject::write()`](api:SilverStripe\ORM\DataObject::write()) has a new boolean `$skipValidation` parameter. This can be useful for scenarios where you want to automatically create a new record with no data initially without restricting how developers can set up their validation rules. - [`FieldList`](api:SilverStripe\Forms\FieldList) is now strongly typed. Methods that previously allowed any iterable variables to be passed, namely [`FieldList::addFieldsToTab()`](api:SilverStripe\Forms\FieldList::addFieldsToTab()) and [`FieldList::removeFieldsFromTab()`](api:SilverStripe\Forms\FieldList::removeFieldsFromTab()), now require an array to be passed instead. - `DNADesign\Elemental\Models\BaseElement::getDescription()` and the corresponding `DNADesign\Elemental\Models\BaseElement.description` configuration property have been removed. If you were using either of these in your custom elemental blocks, either set the new [`class_description`](api:SilverStripe\ORM\DataObject->class_description) configuration property or override one of the [`i18n_classDescription()`](api:SilverStripe\ORM\DataObject::i18n_classDescription()) or [`getTypeNice()`](api:DNADesign\Elemental\Models\BaseElement::getTypeNice()) methods instead.