ClassInfo
class ClassInfo
Provides introspection information about the class tree.
It's a cached wrapper around the built-in class functions. SilverStripe uses class introspection heavily and without the caching it creates an unfortunate performance hit.
Methods
Wrapper for classes getter.
Returns true if a class or interface name exists.
No description
No description
Returns the manifest of all classes which are present in the database.
Returns an array of the current class and all its ancestors and children which require a DB table.
Returns the root class (the first to extend from DataObject) for the passed class.
Returns a list of classes that inherit from the given class.
Convert a class name in any case and return it as it was defined in PHP
Returns the passed class name along with all its parent class names in an array, sorted with the root class first.
No description
Returns true if the given class implements the given interface
Get all classes contained in a file.
Returns all classes contained in a certain folder.
No description
Returns the table name in the class hierarchy which contains a given field column for a {@link DataObject}. If the field does not exist, this will return null.
Details
at line 18
static
allClasses()
Wrapper for classes getter.
at line 28
static bool
exists(string $class)
Returns true if a class or interface name exists.
at line 45
static
hasTable($class)
at line 53
static
reset_db_cache()
at line 66
static array
getValidSubClasses(string $class = 'SiteTree', boolean $includeUnbacked = false)
Returns the manifest of all classes which are present in the database.
at line 83
static array
dataClassesFor(string|object $class)
Returns an array of the current class and all its ancestors and children which require a DB table.
at line 109
static string
baseDataClass(string|object $class)
Returns the root class (the first to extend from DataObject) for the passed class.
at line 145
static array
subclassesFor(mixed $class)
Returns a list of classes that inherit from the given class.
The resulting array includes the base class passed through the $class parameter as the first array value.
Example usage:
ClassInfo::subclassesFor('BaseClass');
array(
'BaseClass' => 'BaseClass',
'ChildClass' => 'ChildClass',
'GrandChildClass' => 'GrandChildClass'
)
at line 169
static string
class_name(string|object $nameOrObject)
Convert a class name in any case and return it as it was defined in PHP
eg: self::class_name('dataobJEct'); //returns 'DataObject'
at line 193
static array
ancestry(string $class, bool $tablesOnly = false)
Returns the passed class name along with all its parent class names in an array, sorted with the root class first.
at line 219
static array
implementorsOf($interfaceName)
at line 226
static
classImplements($className, $interfaceName)
Returns true if the given class implements the given interface
at line 240
static array
classes_for_file(string $filePath)
Get all classes contained in a file.
at line 261
static array
classes_for_folder(string $folderPath)
Returns all classes contained in a certain folder.
at line 275
static
has_method_from($class, $method, $compclass)
at line 309
static string
table_for_object_field(string $candidateClass, string $fieldName)
Returns the table name in the class hierarchy which contains a given field column for a {@link DataObject}. If the field does not exist, this will return null.
Note: In 3.x and below this method may return 'DataObject'. From 4.0 onwards null will be returned if a field is not a member of the object.