Skip to content

Instantly share code, notes, and snippets.

@simonwelsh
Created February 10, 2014 04:32
Show Gist options
  • Save simonwelsh/8910402 to your computer and use it in GitHub Desktop.
Save simonwelsh/8910402 to your computer and use it in GitHub Desktop.
diff --git a/core/ClassInfo.php b/core/ClassInfo.php
index 5a25a4a..c341b5f 100644
--- a/core/ClassInfo.php
+++ b/core/ClassInfo.php
@@ -153,16 +153,17 @@ class ClassInfo {
public static function ancestry($class, $tablesOnly = false) {
if (!is_string($class)) $class = get_class($class);
$cacheKey = $class . '_' . (string)$tablesOnly;
$parent = $class;
if(!isset(self::$_cache_ancestry[$cacheKey])) {
$ancestry = array();
+ class_exists($parent);
do {
if (!$tablesOnly || DataObject::has_own_table($parent)) {
$ancestry[$parent] = $parent;
}
} while ($parent = get_parent_class($parent));
self::$_cache_ancestry[$cacheKey] = array_reverse($ancestry);
}
return self::$_cache_ancestry[$cacheKey];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment