Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC Update validate signature #654

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading