public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false)
    {
        $key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al');

        if (!isset(self::$hierarchy[$key])) {
            $classes = array_values(ClassInfo::ancestry($class));
            if ($includeSubclasses) {
                $classes = array_unique(array_merge($classes, array_values(ClassInfo::subclassesFor($class))));
            }

            $idx = array_search(DataObject::class, $classes);
            if ($idx !== false) {
                array_splice($classes, 0, $idx+1);
            }

            if ($dataOnly) {
                foreach ($classes as $i => $class) {
                    if (!DataObject::getSchema()->classHasTable($class)) {
                        unset($classes[$i]);
                    }
                }
            }

            self::$hierarchy[$key] = $classes;
        }

        return self::$hierarchy[$key];
    }
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false)
    {
        $key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al');

        if (!isset(self::$hierarchy[$key])) {
            $classes = array_values(ClassInfo::ancestry($class));
            if ($includeSubclasses) {
                $classes = array_unique(array_merge($classes, array_values(ClassInfo::subclassesFor($class))));
            }

            $idx = array_search(DataObject::class, $classes);
            if ($idx !== false) {
                array_splice($classes, 0, $idx+1);
            }

            if ($dataOnly) {
                foreach ($classes as $i => $class) {
                    if (!DataObject::getSchema()->classHasTable($class)) {
                        unset($classes[$i]);
                    }
                }
            }

            self::$hierarchy[$key] = $classes;
        }

        return self::$hierarchy[$key];
    }
public static function hierarchy ( $ class , $ includeSubclasses = true , $ dataOnly = false ) { $ key = "$class!" . ( $ includeSubclasses ? 'sc' : 'an' ) . '!' . ( $ dataOnly ? 'do' : 'al' ) ; if ( ! isset ( self :: $ hierarchy [ $ key ] ) ) { $ classes = array_values ( ClassInfo :: ancestry ( $ class ) ) ; if ( $ includeSubclasses ) { $ classes = array_unique ( array_merge ( $ classes , array_values ( ClassInfo :: subclassesFor ( $ class ) ) ) ) ; } $ idx = array_search ( DataObject :: class , $ classes ) ; if ( $ idx !== false ) { array_splice ( $ classes , 0 , $ idx + 1 ) ; } if ( $ dataOnly ) { foreach ( $ classes as $ i => $ class ) { if ( ! DataObject :: getSchema ( ) -> classHasTable ( $ class ) ) { unset ( $ classes [ $ i ] ) ; } } } self :: $ hierarchy [ $ key ] = $ classes ; } return self :: $ hierarchy [ $ key ] ; }
Get all the classes involved in a DataObject hierarchy - both super and optionally subclasses

@static
@param string $class - The class to query
@param bool $includeSubclasses - True to return subclasses as well as super classes
@param bool $dataOnly - True to only return classes that have tables
@return array - Integer keys, String values as classes sorted by depth (most super first)
Get all the classes involved in a DataObject hierarchy - both super and optionally subclasses