public static function dataClassesFor($nameOrObject)
    {
        if (is_string($nameOrObject) && !class_exists($nameOrObject)) {
            return [];
        }

        // Get all classes
        $class = self::class_name($nameOrObject);
        $classes = array_merge(
            self::ancestry($class),
            self::subclassesFor($class)
        );

        // Filter by table
        return array_filter($classes, function ($next) {
            return DataObject::getSchema()->classHasTable($next);
        });
    }