Skip to content

Commit 5f0d4a1

Browse files
committed
DOC Document new class_description and deprecated DBEnum::flushCache()
1 parent 522f598 commit 5f0d4a1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ use SilverStripe\ORM\DataObject;
2828

2929
class Player extends DataObject
3030
{
31+
private static $class_description = 'Sports player';
32+
3133
private static $table_name = 'Player';
3234

3335
private static $db = [

en/08_Changelogs/5.4.0.md

+16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ title: 5.4.0 (unreleased)
99
- [Features and enhancements](#features-and-enhancements)
1010
- [Option to change `ClassName` column from enum to varchar](#classname-varchar)
1111
- [Reports quality of life updates](#reports-quality-of-life-updates)
12+
- [New `class_description` configuration on `DataObject`](#class-description)
1213
- [Other new features](#other-new-features)
1314
- [API changes](#api-changes)
1415
- [Bug fixes](#bug-fixes)
@@ -45,6 +46,18 @@ The changes include:
4546
- Reports list is now paginated
4647
- [`Description`](api:SilverStripe\Reports\Report::description()) is now displayed in the list as a column
4748

49+
### New `class_description` configuration on `DataObject` {#class-description}
50+
51+
[`SiteTree`](api:SilverStripe\CMS\Model\SiteTree) and [`BaseElement`](api:DNADesign\Elemental\Models\BaseElement) both seperately implemented a `description` configuration property which was used to describe the purpose of a given subclass. For `SiteTree` this is used when creating a new page in the CMS. For `BaseElement` this is used in the elemental blocks report. In both cases the purpose is the same - it provides additional context about the intended use case for a given subclass.
52+
53+
We've now implemented this concept in `DataObject` directly with the new [`DataObject.class_description`](api:SilverStripe\ORM\DataObject->class_description) configuration property. It is now considered best practice to add a description of `DataObject` subclasses using this configuration. You can use the new [`DataObject::classDescription()`](api:SilverStripe\ORM\DataObject::classDescription()) and [`DataObject::i18n_classDescription()`](api:SilverStripe\ORM\DataObject::i18n_classDescription()) methods if you need a description of any `DataObject` class. Those methods already existed on `SiteTree` but have been moved up the hierarchy so they can be called on any `DataObject` class.
54+
55+
For now this is only used in the same places that used to use the deprecated configuration, but future minor releases are likely to broaden the scope of its usage.
56+
57+
As a part of this change, the [`SiteTree.description`](api:SilverStripe\CMS\Model\SiteTree->description) and [`BaseElement.description`](api:DNADesign\Elemental\Models\BaseElement->description) configuration properties are now deprecated. Use `class_description` instead.
58+
59+
The `SilverStripe\CMS\Model\SiteTree.DESCRIPTION` localisation key (along with the `.DESCRIPTION` suffix for any `SiteTree` subclass) will stop being used in a future major release. Use `SilverStripe\CMS\Model\SiteTree.CLASS_DESCRIPTION` instead.
60+
4861
### Other new features
4962

5063
- A new [`BaseKernel::getBooted()`](api:SilverStripe\Core\BaseKernel::getBooted()) method has been added for checking whether the kernel has been booted yet or not.
@@ -166,6 +179,9 @@ The changes include:
166179
- [`TemplateParser`](api:SilverStripe\View\TemplateParser) has been deprecated. It will be renamed to `SilverStripe\TemplateEngine\TemplateParser`.
167180
- [`ElementalAreaController::removeNamespacesFromFields()`](api:DNADesign\Elemental\Controllers\ElementalAreaController::removeNamespacesFromFields()) has been deprecated. It will be removed without equivalent functionality to replace it.
168181
- [`BaseElement::updateFromFormData()`](api:DNADesign\Elemental\Models\BaseElement::updateFromFormData()) has been deprecated. It will be removed without equivalent functionality to replace it.
182+
- [`DBEnum::flushCache()`](api:SilverStripe\ORM\FieldType\DBEnum::flushCache()) has been deprecated. Use [`DBEnum::reset()`](api:SilverStripe\ORM\FieldType\DBEnum::reset()) instead.
183+
- The [`BaseElement.description`](api:DNADesign\Elemental\Models\BaseElement->description) configuration property has been deprecated. Use [`DataObject.class_description`](api:SilverStripe\ORM\DataObject->class_description) instead.
184+
- The [`SiteTree.description`](api:SilverStripe\CMS\Model\SiteTree->description) configuration property has been deprecated. Use [`DataObject.class_description`](api:SilverStripe\ORM\DataObject->class_description) instead.
169185

170186
## Bug fixes
171187

0 commit comments

Comments
 (0)