@@ -116,17 +116,19 @@ 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
+ * Used in some areas of the CMS, e.g. when selecting what type of record to create.
130
+ */
131
+ private static ?string $ class_description = null ;
130
132
131
133
/**
132
134
* @config
@@ -946,6 +948,27 @@ public function i18n_plural_name()
946
948
return _t (static ::class . '.PLURALNAME ' , $ this ->plural_name ());
947
949
}
948
950
951
+ /**
952
+ * Get description for this class
953
+ */
954
+ public function classDescription (): ?string
955
+ {
956
+ return static ::config ()->get ('class_description ' );
957
+ }
958
+
959
+ /**
960
+ * Get localised description for this class
961
+ */
962
+ public function i18nClassDescription (): ?string
963
+ {
964
+ $ placeholder = 'PLACEHOLDER_DESCRIPTION ' ;
965
+ $ description = _t (static ::class.'.CLASS_DESCRIPTION ' , $ this ->classDescription () ?? $ placeholder );
966
+ if ($ description === $ placeholder ) {
967
+ return null ;
968
+ }
969
+ return $ description ;
970
+ }
971
+
949
972
/**
950
973
* Standard implementation of a title/label for a specific
951
974
* record. Tries to find properties 'Title' or 'Name',
@@ -3509,14 +3532,11 @@ public static function get_one($callerClass = null, $filter = "", $cache = true,
3509
3532
}
3510
3533
3511
3534
/**
3512
- * Flush the cached results for all relations (has_one, has_many, many_many)
3513
- * Also clears any cached aggregate data.
3535
+ * @inheritDoc
3514
3536
*
3515
- * @param boolean $persistent When true will also clear persistent data stored in the Cache system.
3516
- * When false will just clear session-local cached data
3517
- * @return static $this
3537
+ * Also flush the cached results for all relations (has_one, has_many, many_many)
3518
3538
*/
3519
- public function flushCache ($ persistent = true )
3539
+ public function flushCache (bool $ persistent = true ): static
3520
3540
{
3521
3541
if (static ::class == DataObject::class) {
3522
3542
DataObject::$ _cache_get_one = [];
@@ -3530,11 +3550,9 @@ public function flushCache($persistent = true)
3530
3550
}
3531
3551
}
3532
3552
3533
- $ this ->extend ('onFlushCache ' );
3534
-
3535
3553
$ this ->components = [];
3536
3554
$ this ->eagerLoadedData = [];
3537
- return $ this ;
3555
+ return parent :: flushCache ( $ persistent ) ;
3538
3556
}
3539
3557
3540
3558
/**
@@ -3561,7 +3579,7 @@ public static function flush_and_destroy_cache()
3561
3579
*/
3562
3580
public static function reset ()
3563
3581
{
3564
- DBEnum::flushCache ();
3582
+ DBEnum::clearStaticCache ();
3565
3583
ClassInfo::reset_db_cache ();
3566
3584
static ::getSchema ()->reset ();
3567
3585
DataObject::$ _cache_get_one = [];
0 commit comments