/** * gets table representing class in database * @static * @param mixed $mxd either a string(class name) or an object * @return string name of table in database representing class(string) or object * false if no table found */ static function Class2Table($mxd) { $origClass = is_object($mxd) ? get_class($mxd) : $mxd; class_exists($origClass) or trigger_error("MyActiveRecord::Class2Table - Class {$origClass} does not exist", E_USER_ERROR); $class = $origClass; while (!MyActiveRecord::TableExists(strtolower($class)) && $class != 'MyActiveRecord') { $class = get_parent_class($class); } $table = strtolower($class); if ($table == 'myactiverecord') { trigger_error("MyActiveRecord::Class2Table - Class {$origClass} does not have a table representation", E_USER_ERROR); return false; } return $table; }