@@ -116,17 +116,22 @@ class DataObject extends ModelData implements DataObjectInterface, i18nEntityPro
116
116
{
117
117
/**
118
118
* Human-readable singular name.
119
- * @var string
120
- * @config
121
119
*/
122
- private static $ singular_name = null ;
120
+ private static ? string $ singular_name = null ;
123
121
124
122
/**
125
123
* Human-readable plural name
126
- * @var string
127
- * @config
128
124
*/
129
- private static $ plural_name = null ;
125
+ private static ?string $ plural_name = null ;
126
+
127
+ /**
128
+ * Description of the class.
129
+ * Unlike most configuration, this is usually used uninherited, meaning it should be defined
130
+ * on each subclass.
131
+ *
132
+ * Used in some areas of the CMS, e.g. when selecting what type of record to create.
133
+ */
134
+ private static ?string $ class_description = null ;
130
135
131
136
/**
132
137
* @config
@@ -946,6 +951,27 @@ public function i18n_plural_name()
946
951
return _t (static ::class . '.PLURALNAME ' , $ this ->plural_name ());
947
952
}
948
953
954
+ /**
955
+ * Get description for this class
956
+ */
957
+ public function classDescription (): ?string
958
+ {
959
+ return static ::config ()->get ('class_description ' , Config::UNINHERITED );
960
+ }
961
+
962
+ /**
963
+ * Get localised description for this class
964
+ */
965
+ public function i18nClassDescription (): ?string
966
+ {
967
+ $ placeholder = 'PLACEHOLDER_DESCRIPTION ' ;
968
+ $ description = _t (static ::class.'.CLASS_DESCRIPTION ' , $ this ->classDescription () ?? $ placeholder );
969
+ if ($ description === $ placeholder ) {
970
+ return null ;
971
+ }
972
+ return $ description ;
973
+ }
974
+
949
975
/**
950
976
* Standard implementation of a title/label for a specific
951
977
* record. Tries to find properties 'Title' or 'Name',
@@ -3515,14 +3541,11 @@ public static function get_one($callerClass = null, $filter = "", $cache = true,
3515
3541
}
3516
3542
3517
3543
/**
3518
- * Flush the cached results for all relations (has_one, has_many, many_many)
3519
- * Also clears any cached aggregate data.
3544
+ * @inheritDoc
3520
3545
*
3521
- * @param boolean $persistent When true will also clear persistent data stored in the Cache system.
3522
- * When false will just clear session-local cached data
3523
- * @return static $this
3546
+ * Also flush the cached results for all relations (has_one, has_many, many_many)
3524
3547
*/
3525
- public function flushCache ($ persistent = true )
3548
+ public function flushCache (bool $ persistent = true ): static
3526
3549
{
3527
3550
if (static ::class == DataObject::class) {
3528
3551
DataObject::$ _cache_get_one = [];
@@ -3536,11 +3559,9 @@ public function flushCache($persistent = true)
3536
3559
}
3537
3560
}
3538
3561
3539
- $ this ->extend ('onFlushCache ' );
3540
-
3541
3562
$ this ->components = [];
3542
3563
$ this ->eagerLoadedData = [];
3543
- return $ this ;
3564
+ return parent :: flushCache ( $ persistent ) ;
3544
3565
}
3545
3566
3546
3567
/**
@@ -3567,7 +3588,7 @@ public static function flush_and_destroy_cache()
3567
3588
*/
3568
3589
public static function reset ()
3569
3590
{
3570
- DBEnum::flushCache ();
3591
+ DBEnum::clearStaticCache ();
3571
3592
ClassInfo::reset_db_cache ();
3572
3593
static ::getSchema ()->reset ();
3573
3594
DataObject::$ _cache_get_one = [];
0 commit comments