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 Document new class_description and deprecated DBEnum::flushCache() #626

Merged

Conversation

Comment on lines 29 to 32
class Player extends DataObject
{
private static $class_description = 'Sports ball player';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is theoretically the first docs that show how to create a DataObject class so I'm adding best practice here.

I'm not adding it to all docs that show creating a DataObject class because a) that's a lot of examples and b) it's not really relevant for most of them.


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.

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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see it being used as a tooltip when hovering over elemental blocks in the "Add new block" list and added to the GridFieldAddNewMultiClass component in gridfield extensions at the very least.

en/08_Changelogs/5.4.0.md Show resolved Hide resolved

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.

The `SilverStripe\CMS\Model\SiteTree.DESCRIPTION` localisation key (along with the `.DESCRIPTION` suffix for any `SiteTree` subclass) is also deprecated - use `SilverStripe\CMS\Model\SiteTree.CLASS_DESCRIPTION` instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `SilverStripe\CMS\Model\SiteTree.DESCRIPTION` localisation key (along with the `.DESCRIPTION` suffix for any `SiteTree` subclass) is also deprecated - use `SilverStripe\CMS\Model\SiteTree.CLASS_DESCRIPTION` instead.

We don't "deprecate" translation keys?

Copy link
Member Author

@GuySartorelli GuySartorelli Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I literally did though, see the framework PR. The code in CMS 6 won't be using the old key, it'll be using a new key. So the old key is therefore deprecated.

We don't have a policy about how or when to deprecate those, sure. but SiteTree is such a high traffic class that it feels appropriate to give notice about this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree offline to remove the translation deprecation notices

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't discuss the changelog in that discussion.
I'd like to still mention it in the changelog, though I'm okay with not using the word "deprecated".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to not use "deprecated" language

@@ -28,6 +28,8 @@ use SilverStripe\ORM\DataObject;

class Player extends DataObject
{
private static $class_description = 'Sports ball player';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static $class_description = 'Sports ball player';
private static $class_description = 'Sports player';

Sports ball player sounds a bit weird

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIP joke.
Done.

@emteknetnz emteknetnz merged commit b1a5f0b into silverstripe:5 Nov 14, 2024
3 checks passed
@emteknetnz emteknetnz deleted the pulls/5/class-description branch November 14, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants