$self->_inject($table_class, @{$self->left_base_classes});
my @components = @{ $self->components || [] };
- foreach my $moniker (keys %{ $self->result_component_map || {} }) {
- next unless $moniker eq $table_moniker;
- push @components, @{ $self->result_component_map->{$moniker} };
- }
+
+ push @components, @{ $self->result_component_map->{$table_moniker} }
+ if exists $self->result_component_map->{$table_moniker};
+
$self->_dbic_stmt($table_class, 'load_components', @components) if @components;
$self->_inject($table_class, @{$self->additional_base_classes});
if (not $self->_result_class_methods) {
my (@methods, %methods);
my $base = $self->result_base_class || 'DBIx::Class::Core';
- my @components = map { /^\+/ ? substr($_,1) : "DBIx::Class::$_" } @{ $self->components || [] };
- foreach my $moniker (keys %{ $self->result_component_map || {} }) {
- next unless $moniker eq $table_moniker;
- push @components, @{ $self->result_component_map->{$moniker} };
+
+ my @components = @{ $self->components || [] };
+
+ push @components, @{ $self->result_component_map->{$table_moniker} }
+ if exists $self->result_component_map->{$table_moniker};
+
+ for my $c (@components) {
+ $c = $c =~ /^\+/ ? substr($c,1) : "DBIx::Class::$c";
}
for my $class ($base, @components, $self->use_moose ? 'Moose::Object' : ()) {
$num_rescans++ if $self->{vendor} eq 'Firebird';
plan tests => @connect_info *
- (188 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
+ (192 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
foreach my $info_idx (0..$#connect_info) {
my $info = $connect_info[$info_idx];
col_collision_map => { '^(can)\z' => 'caught_collision_%s' },
rel_collision_map => { '^(set_primary_key)\z' => 'caught_rel_collision_%s' },
col_accessor_map => \&test_col_accessor_map,
+ result_component_map => { LoaderTest2X => 'TestComponentForMap', LoaderTest1 => '+TestComponentForMapFQN' },
%{ $self->{loader_options} || {} },
);
'Additional Component' );
}
- is ((try { $class1->testcomponent_fqn }), 'TestComponentFQN works',
- 'fully qualified component class');
+ is try { $class2->dbix_class_testcomponentformap }, 'dbix_class_testcomponentformap works',
+ 'component from result_component_map';
+
+ isnt try { $class1->dbix_class_testcomponentformap }, 'dbix_class_testcomponentformap works',
+ 'component from result_component_map not added to not mapped Result';
+
+ is try { $class1->testcomponent_fqn }, 'TestComponentFQN works',
+ 'fully qualified component class';
+
+ is try { $class1->testcomponentformap_fqn }, 'TestComponentForMapFQN works',
+ 'fully qualified component class from result_component_map';
+
+ isnt try { $class2->testcomponentformap_fqn }, 'TestComponentForMapFQN works',
+ 'fully qualified component class from result_component_map not added to not mapped Result';
SKIP: {
can_ok( $class1, 'loader_test1_classmeth' )