public function get_table_class_files() { $table_class_files = array(); /* * The default table class file. */ $default_table_class_file = new FileSystem_PHPClassFile(PROJECT_ROOT . '/haddock/database/classes/elements/' . 'Database_Table.inc.php'); $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $table_names = $database->get_table_names(); $project_directory = $this->get_project_directory(); $php_class_files = $project_directory->get_php_class_files(); #print_r($php_class_files); #$table_reflection_class = new ReflectionClass('Database_Table'); $table_reflection_class = $default_table_class_file->get_reflection_class(); #print_r($table_reflection_class); foreach ($table_names as $table_name) { $table_class_files[$table_name][] = $default_table_class_file; foreach ($php_class_files as $php_class_file) { $php_class_file->declare_class(); $php_class_file_reflection_class = $php_class_file->get_reflection_class(); #echo $php_class_file_reflection_class->getName() . "<br />\n"; #print_r($php_class_file_reflection_class); # #echo '$php_class_file_reflection_class->isAbstract(): ' . "\n"; #echo $php_class_file_reflection_class->isAbstract() . "\n"; # #echo '$php_class_file_reflection_class->isSubclassOf($table_reflection_class): ' . "\n"; #echo $php_class_file_reflection_class->isSubclassOf($table_reflection_class) . "\n"; if (!$php_class_file_reflection_class->isAbstract() && $php_class_file_reflection_class->isSubclassOf($table_reflection_class)) { #echo 'Appending ' # . $php_class_file->get_php_class_name() # . " to the array.\n"; $table_class_files[$table_name][] = $php_class_file; } } } #print_r($table_class_files); return $table_class_files; }
public function get_table_class_files() { $table_class_files = array(); /* * The default table class file. */ $default_table_class_file = new FileSystem_PHPClassFile(PROJECT_ROOT . '/plug-ins/database/classes/elements/' . 'Database_Table.inc.php'); $mysql_user_factory = Database_MySQLUserFactory::get_instance(); $mysql_user = $mysql_user_factory->get_for_this_project(); $database = $mysql_user->get_database(); $table_names = $database->get_table_names(); $project_directory = $this->get_project_directory(); $php_class_files = $project_directory->get_php_class_files(); $table_reflection_class = $default_table_class_file->get_reflection_class(); foreach ($table_names as $table_name) { $table_class_files[$table_name][] = $default_table_class_file; foreach ($php_class_files as $php_class_file) { $php_class_file->declare_class(); $php_class_file_reflection_class = $php_class_file->get_reflection_class(); if (!$php_class_file_reflection_class->isAbstract() && $php_class_file_reflection_class->isSubclassOf($table_reflection_class)) { $table_class_files[$table_name][] = $php_class_file; } } } return $table_class_files; }