public function create_file_for_table(Database_Table $table, HaddockProjectOrganisation_ModuleDirectory $module_directory) { if (!$module_directory->has_table_specification_directory()) { $module_directory->create_table_specification_directory(); } $table_specification_directory = $module_directory->get_table_specification_directory(); if ($table_specification_directory->has_file_for_table($table)) { $table_name = $table->get_name(); $table_specification_directory_name = $table_specification_directory->get_name(); $msg = <<<SQL There is already a table specification file for {$table_name} in {$table_specification_directory_name}! Unable to create another! SQL; throw new Exception($msg); } $table_specification_directory->create_file_for_table($table); $table_specification_file = $table_specification_directory->get_file_for_table($table); $table_specification_file->save_table_structure($table); }