From: Matt S Trout Date: Mon, 26 Dec 2005 01:44:47 +0000 (+0000) Subject: Moved resultset_instance into DB.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6858c33d9bff4ee2e44c2cbbee9c68537adf11c;p=dbsrgits%2FDBIx-Class-Historic.git Moved resultset_instance into DB.pm --- diff --git a/lib/DBIx/Class/DB.pm b/lib/DBIx/Class/DB.pm index fd8d5b7..cc9fecd 100644 --- a/lib/DBIx/Class/DB.pm +++ b/lib/DBIx/Class/DB.pm @@ -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 diff --git a/lib/DBIx/Class/TableInstance.pm b/lib/DBIx/Class/TableInstance.pm index e9a92ce..634291f 100644 --- a/lib/DBIx/Class/TableInstance.pm +++ b/lib/DBIx/Class/TableInstance.pm @@ -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,