src/Core/ClassInfo.php
public static function ancestry($nameOrObject, $tablesOnly = false)
    {
        if (is_string($nameOrObject) && !class_exists($nameOrObject)) {
            return [];
        }

        $class = self::class_name($nameOrObject);

        $lowerClass = strtolower($class);

        $cacheKey = $lowerClass . '_' . (string)$tablesOnly;
        $parent = $class;
        if (!isset(self::$_cache_ancestry[$cacheKey])) {
            $ancestry = [];
            do {
                if (!$tablesOnly || DataObject::getSchema()->classHasTable($parent)) {
                    $ancestry[strtolower($parent)] = $parent;
                }
            } while ($parent = get_parent_class($parent));
            self::$_cache_ancestry[$cacheKey] = array_reverse($ancestry);
        }

        return self::$_cache_ancestry[$cacheKey];
    }
public static function ancestry($nameOrObject, $tablesOnly = false)
    {
        if (is_string($nameOrObject) && !class_exists($nameOrObject)) {
            return [];
        }

        $class = self::class_name($nameOrObject);

        $lowerClass = strtolower($class);

        $cacheKey = $lowerClass . '_' . (string)$tablesOnly;
        $parent = $class;
        if (!isset(self::$_cache_ancestry[$cacheKey])) {
            $ancestry = [];
            do {
                if (!$tablesOnly || DataObject::getSchema()->classHasTable($parent)) {
                    $ancestry[strtolower($parent)] = $parent;
                }
            } while ($parent = get_parent_class($parent));
            self::$_cache_ancestry[$cacheKey] = array_reverse($ancestry);
        }

        return self::$_cache_ancestry[$cacheKey];
    }
public static function ancestry ( $ nameOrObject , $ tablesOnly = false ) { if ( is_string ( $ nameOrObject ) && ! class_exists ( $ nameOrObject ) ) { return [ ] ; } $ class = self :: class_name ( $ nameOrObject ) ; $ lowerClass = strtolower ( $ class ) ; $ cacheKey = $ lowerClass . '_' . ( string ) $ tablesOnly ; $ parent = $ class ; if ( ! isset ( self :: $ _cache_ancestry [ $ cacheKey ] ) ) { $ ancestry = [ ] ; do { if ( ! $ tablesOnly || DataObject :: getSchema ( ) -> classHasTable ( $ parent ) ) { $ ancestry [ strtolower ( $ parent ) ] = $ parent ; } } while ( $ parent = get_parent_class ( $ parent ) ) ; self :: $ _cache_ancestry [ $ cacheKey ] = array_reverse ( $ ancestry ) ; } return self :: $ _cache_ancestry [ $ cacheKey ] ; }
Returns the passed class name along with all its parent class names in an
array, sorted with the root class first.

@param string|object $nameOrObject Class or object instance
@param bool $tablesOnly Only return classes that have a table in the db.
@return array List of class names with lowercase keys and correct-case values
Returns the passed class name along with all its parent class names in an array sorted with the root class first .