Skip to content

Commit

Permalink
Merge pull request #654 from creative-commoners/pulls/6.0/validation-…
Browse files Browse the repository at this point in the history
…interface

DOC Update validate signature
  • Loading branch information
GuySartorelli authored Dec 17, 2024
2 parents b901a16 + 0f91900 commit b4fc845
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion en/02_Developer_Guides/00_Model/09_Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -58,7 +59,7 @@ class MyObject extends DataObject
'Postcode' => 'Varchar',
];

public function validate()
public function validate(): ValidationResult
{
$result = parent::validate();

Expand Down
1 change: 1 addition & 0 deletions en/08_Changelogs/6.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b4fc845

Please sign in to comment.