[Bast-commits] r4740 - DBIx-Class/0.08/trunk/lib/DBIx/Class
lukes at dev.catalyst.perl.org
lukes at dev.catalyst.perl.org
Thu Aug 7 02:31:52 BST 2008
Author: lukes
Date: 2008-08-07 02:31:51 +0100 (Thu, 07 Aug 2008)
New Revision: 4740
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
Log:
further simplified compose_namespace
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2008-08-07 01:13:06 UTC (rev 4739)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2008-08-07 01:31:51 UTC (rev 4740)
@@ -615,26 +615,23 @@
=cut
+# this might be oversimplified
sub compose_namespace {
my ($self, $target, $base) = @_;
- $self = $self->clone;
- foreach my $moniker ($self->sources) {
- my $source = $self->source($moniker);
- my $source_class = ref $source;
- my $source_copy = $source_class->new({
- %$source,
- _relationships => Storable::dclone( $source->_relationships ),
- });
-
- my $target_class = "${target}::${moniker}";
- $self->inject_base(
- $target_class => $source_copy->result_class, ($base ? $base : ())
- );
- $source_copy->result_class($target_class);
- $self->register_source($moniker, $source_copy);
+ my $schema = $self->clone;
+ foreach my $moniker ($schema->sources) {
+ my $source = $schema->source($moniker);
+ my $target_class = "${target}::${moniker}";
+ $self->inject_base(
+ $target_class => $source->result_class, ($base ? $base : ())
+ );
+ $source->result_class($target_class);
+ $target_class->result_source_instance($source)
+ if $target_class->can('result_source_instance');
+ $schema->register_source($moniker, $source);
}
- return $self;
+ return $schema;
}
sub setup_connection_class {
More information about the Bast-commits
mailing list