Skip to content

Commit

Permalink
Verify all ancestors when building object model.
Browse files Browse the repository at this point in the history
git-svn-id: http://voip.null.ro/svn/ansql/trunk@206 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed Feb 22, 2016
1 parent 9b0ceee commit 67407c9
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -2455,8 +2455,7 @@ static function init()
//print "default_identifier=$default_identifier\n";
foreach ($classes as $class)
{
// calling static class methods is done using an array("class","method")
if (get_parent_class($class) == "Model" || get_parent_class(get_parent_class($class)) == "Model")
if (self::checkAncestors($class))
{
$vars = null;
if (!method_exists($class,"variables"))
Expand Down Expand Up @@ -2486,6 +2485,22 @@ static function init()
}
}

/**
* Check class ancestors to see if one of them is Model
* @param $class String
* @return Bool
*/
static function checkAncestors($class)
{
$parent = get_parent_class($class);

if ($parent=="Model")
return true;
elseif (!$parent)
return false;
return self::checkAncestors($parent);
}

/**
* Get the identifier of the current database connection
* @return String representing the db identifier
Expand Down

0 comments on commit 67407c9

Please sign in to comment.