Moved resultset_instance into DB.pm
Matt S Trout [Mon, 26 Dec 2005 01:44:47 +0000 (01:44 +0000)]
lib/DBIx/Class/DB.pm
lib/DBIx/Class/TableInstance.pm

index fd8d5b7..cc9fecd 100644 (file)
@@ -12,6 +12,14 @@ __PACKAGE__->load_components(qw/ResultSetInstance/);
 
 sub storage { shift->storage_instance(@_); }
 
+sub resultset_instance {
+  my $class = shift;
+  my $table = $class->table_instance->new($class->table_instance);
+  $table->storage($class->storage_instance);
+  $table->result_class($class);
+  return $table->resultset;
+}
+
 =head1 NAME 
 
 DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance
index e9a92ce..634291f 100644 (file)
@@ -9,6 +9,7 @@ use DBIx::Class::Table;
 __PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do anything yet!
 
 __PACKAGE__->mk_classdata('_resultset_class' => 'DBIx::Class::ResultSet');
+__PACKAGE__->mk_classdata('table_class' => 'DBIx::Class::Table');
 
 sub iterator_class { shift->table_instance->resultset_class(@_) }
 sub resultset_class { shift->table_instance->resultset_class(@_) }
@@ -47,14 +48,6 @@ sub add_columns {
   $class->_mk_column_accessors(@cols);
 }
 
-sub resultset_instance {
-  my $class = shift;
-  my $table = $class->table_instance->new($class->table_instance);
-  $table->storage($class->storage_instance);
-  $table->result_class($class);
-  return $table->resultset;
-}
-
 sub _select_columns {
   return shift->table_instance->columns;
 }
@@ -71,7 +64,7 @@ sub table {
   my ($class, $table) = @_;
   return $class->table_instance->name unless $table;
   unless (ref $table) {
-    $table = DBIx::Class::Table->new(
+    $table = $class->table_class->new(
       {
         name => $table,
         result_class => $class,