@@ -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',
@@ -3509,14 +3535,11 @@ public static function get_one($callerClass = null, $filter = "", $cache = true,
3509
3535
}
3510
3536
3511
3537
/**
3512
- * Flush the cached results for all relations (has_one, has_many, many_many)
3513
- * Also clears any cached aggregate data.
3538
+ * @inheritDoc
3514
3539
*
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
3540
+ * Also flush the cached results for all relations (has_one, has_many, many_many)
3518
3541
*/
3519
- public function flushCache ($ persistent = true )
3542
+ public function flushCache (bool $ persistent = true ): static
3520
3543
{
3521
3544
if (static ::class == DataObject::class) {
3522
3545
DataObject::$ _cache_get_one = [];
@@ -3530,11 +3553,9 @@ public function flushCache($persistent = true)
3530
3553
}
3531
3554
}
3532
3555
3533
- $ this ->extend ('onFlushCache ' );
3534
-
3535
3556
$ this ->components = [];
3536
3557
$ this ->eagerLoadedData = [];
3537
- return $ this ;
3558
+ return parent :: flushCache ( $ persistent ) ;
3538
3559
}
3539
3560
3540
3561
/**
@@ -3561,7 +3582,7 @@ public static function flush_and_destroy_cache()
3561
3582
*/
3562
3583
public static function reset ()
3563
3584
{
3564
- DBEnum::flushCache ();
3585
+ DBEnum::clearStaticCache ();
3565
3586
ClassInfo::reset_db_cache ();
3566
3587
static ::getSchema ()->reset ();
3567
3588
DataObject::$ _cache_get_one = [];
0 commit comments