DOC Add some extra details to the changelog about toast notification and DataObject hydration (#9754)

This commit is contained in:
Maxime Rainville 2020-11-04 11:09:50 +13:00 committed by GitHub
parent 6c2713894a
commit bf6a52b9c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 0 deletions

View File

@ -7,6 +7,8 @@
- [Default MySQL collation updated](#default-mysql-collation-updated)
- [MySQL connection mode configurable](#mysql-connection-mode-now-configurable)
- [Flysystem dependency shifted](#flysystem-dependency-shifted)
- [Improved Toast notifications](#improved-toast-notifications)
- [DataObject constructor support for hydration](#dataobject-constructor-support-for-hydration)
## New features
@ -76,3 +78,25 @@ An edgecase exists where a project can update to `silverstripe/framework 4.7.0`
`silverstripe/assets 1.6.x`, and lose the Flysystem dependency entirely. The best way to avoid this
is by ensuring you update all core modules to the new minor release at once, ideally through a core
recipe like `silverstripe/recipe-core`.
### Improved Toast notifications
Toast notifications have been completely revamped
- Toast notifications can now be triggered from React components using Redux actions
- Actions can now be attached to the toast notifications
- Accessibility has been improved (see the component documentation for caveats when using actions)
Asset-admin has been updated to use toast notifications instead of alerts. More modules will start
using them in future releases.
[Review the Toast story in the pattern library](https://silverstripe.github.io/silverstripe-admin/?selectedKind=Admin%2FToasts&selectedStory=Single)
to learn how and when to use the toast notifications.
### DataObject constructor support for hydration
Many developers wrongly assumed that the DataObject constructor could be used to "hydrate" a record
by passing an array of value to it. While this worked in some cases, values would be run through
setters and validation occasionally leading to inconsistencies.
Silverstripe CMS Recipe 4.7 introduces improvements to the DataObject constructor to provide proper
support for hydration.

View File

@ -7,6 +7,8 @@
- [Default MySQL collation updated](#default-mysql-collation-updated)
- [MySQL connection mode configurable](#mysql-connection-mode-now-configurable)
- [Flysystem dependency shifted](#flysystem-dependency-shifted)
- [Improved Toast notifications](#improved-toast-notifications)
- [DataObject constructor support for hydration](#dataobject-constructor-support-for-hydration)
## New features
@ -77,6 +79,43 @@ An edgecase exists where a project can update to `silverstripe/framework 4.7.0`
is by ensuring you update all core modules to the new minor release at once, ideally through a core
recipe like `silverstripe/recipe-core`.
### Improved Toast notifications
Toast notifications have been completely revamped
- Toast notifications can now be triggered from React components using Redux actions
- Actions can now be attached to the toast notifications
- Accessibility has been improved (see the component documentation for caveats when using actions)
Asset-admin has been updated to use toast notifications instead of alerts. More modules will start
using them in future releases.
[Review the Toast story in the pattern library](https://silverstripe.github.io/silverstripe-admin/?selectedKind=Admin%2FToasts&selectedStory=Single)
to learn how and when to use the toast notifications.
### DataObject constructor support for hydration
Many developers wrongly assumed that the DataObject constructor could be used to "hydrate" a record
by passing an array of value to it. While this worked in some cases, values would be run through
setters and validation occasionally leading to inconsistencies.
Silverstripe CMS Recipe 4.7 introduces improvements to the DataObject constructor to provide proper
support for hydration.
```php
// Default behavior. Setters and validation will be applied to the provided data.
// Equivalent to `Foo::create(['Title' => 'Bar'])`
$newFoo = Foo::create(['Title' => 'Bar'], DataObject::CREATE_OBJECT);
// Creates a "singleton" instance. The provided data will be ignored.
// Equivalent to `Foo::singleton()`
$newFoo = Foo::create(['Title' => 'Bar'], DataObject::CREATE_SINGLETON);
// Hydrate the record with data manually retrieved from the database. The provided
// data is stored directly in the DataObject without going through setters or validation.
// This was not possible prior to the the 4.7 release.
$newFoo = Foo::create(['Title' => 'Bar', 'ID' => 123], DataObject::CREATE_HYDRATED);
```
## Change Log
### API Changes