first attempt at getting resultset load order correct, tests pass
Devin Austin [Wed, 19 Jan 2011 20:13:57 +0000 (13:13 -0700)]
lib/DBIx/Class/ResultSource.pm
t/lib/A/MoarUseless.pm [new file with mode: 0644]
t/lib/A/MoarUselessRSLoader.pm [new file with mode: 0644]
t/lib/DBICTest/Schema/Artist.pm
t/resultset/components.t

index e8920b0..6703a0f 100644 (file)
@@ -1889,7 +1889,7 @@ sub inject_resultset_components {
    my @components = @{shift @_};
 
    # this generation of class bit needs to go into CCC
-   my $class = $self->resultset_class . '::' . rand(100);
+   my $class = $self->resultset_class . "::WITH::" . join ("::", @components);
    Class::C3::Componentised->inject_base($class, $self->resultset_class);
    $self->resultset_class($class);
 
diff --git a/t/lib/A/MoarUseless.pm b/t/lib/A/MoarUseless.pm
new file mode 100644 (file)
index 0000000..ce2faeb
--- /dev/null
@@ -0,0 +1,3 @@
+package A::MoarUseless;
+
+1;
diff --git a/t/lib/A/MoarUselessRSLoader.pm b/t/lib/A/MoarUselessRSLoader.pm
new file mode 100644 (file)
index 0000000..e4b46cd
--- /dev/null
@@ -0,0 +1,7 @@
+package A::MoarUselessRSLoader;
+
+use Class::C3::Componentised::LoadActions;
+
+AFTER_APPLY { $_[0]->result_source_instance->inject_resultset_components(['+A::MoarUseless']) };
+
+1;
index 530ee89..7d6a262 100644 (file)
@@ -65,7 +65,7 @@ __PACKAGE__->has_many(
 );
 __PACKAGE__->many_to_many('artworks', 'artwork_to_artist', 'artwork');
 
-__PACKAGE__->result_source_instance->inject_resultset_components(['+A::Useless']);
+__PACKAGE__->result_source_instance->inject_resultset_components(['+A::Useless', '+A::MoarUseless']);
 
 sub sqlt_deploy_hook {
   my ($self, $sqlt_table) = @_;
index cd637e9..3f66e6d 100644 (file)
@@ -5,12 +5,25 @@ use Test::More;
 
 use lib qw(t/lib);
 use DBICTest;
-
+use Data::Dumper;
 my $schema = DBICTest->init_schema;
 
 isa_ok $schema->resultset('Artist'), 'A::Useless', 'Artist RS';
 ok !$schema->resultset('CD')->isa('A::Useless'), 'CD RS is not A::Useless';
 
+my @classes = ('DBICTest::BaseResultSet::WITH::+A::Useless::+A::MoarUseless',
+               'A::Useless',
+               'A::MoarUseless',
+               'DBICTest::BaseResultSet',
+               'DBIx::Class::ResultSet',
+               'DBIx::Class',
+               'DBIx::Class::Componentised',
+               'Class::C3::Componentised',
+               'Class::Accessor::Grouped');
+warn "classes: " . Dumper \@classes;
+
+is_deeply(mro::get_linear_isa(ref $schema->resultset('Artist')), \@classes, 'Proper ISA Stack Order');
+
 isa_ok $schema->resultset('Employee'), 'A::Useless', 'Employee RS';
 
 done_testing;