additional_classes
additional_base_classes
left_base_classes
- components
- resultset_components
+ components
+ resultset_components
relationships
inflect
db_schema
$self->_ensure_arrayref(qw/additional_classes
additional_base_classes
left_base_classes
- components
- resultset_components/);
+ components
+ resultset_components/);
push(@{$self->{components}}, 'ResultSetManager')
if @{$self->{resultset_components}};
my $table_moniker = $self->_table2moniker($db_schema, $tbl);
my $table_class = $schema . q{::} . $table_moniker;
- $self->_inject($table_class, 'DBIx::Class::Core');
- $self->_inject($table_class, @db_classes);
- $self->_inject($table_class, @{$self->additional_base_classes});
+ { no strict 'refs';
+ @{"${table_class}::ISA"} = ($schema);
+ }
$self->_use ($table_class, @{$self->additional_classes});
+ $self->_inject($table_class, @{$self->additional_base_classes});
+ $table_class->load_components(@{$self->components}, @db_classes, 'Core');
+ $table_class->load_resultset_components(@{$self->resultset_components})
+ if @{$self->resultset_components};
$self->_inject($table_class, @{$self->left_base_classes});
- $table_class->load_components(@{$self->components});
- $table_class->load_resultset_components(@{$self->resultset_components})
- if @{$self->resultset_components};
warn qq/\# Initializing table "$tablename" as "$table_class"\n/
if $self->debug;
additional_classes => 'TestAdditional',
additional_base_classes => 'TestAdditionalBase',
left_base_classes => [ qw/TestLeftBase/ ],
- components => [ qw/TestComponent/ ],
- resultset_components => [ qw/TestRSComponent/ ],
+ components => [ qw/TestComponent/ ],
+ resultset_components => [ qw/TestRSComponent/ ],
debug => $debug,
);
{
my ($skip_tab, $skip_tabo, $skip_taba, $skip_cmeth,
- $skip_rsmeth, $skip_tcomp, $skip_trscomp);
+ $skip_rsmeth, $skip_tcomp, $skip_trscomp);
can_ok( $class1, 'test_additional_base' ) or $skip_tab = 1;
can_ok( $class1, 'test_additional_base_override' ) or $skip_tabo = 1;
can_ok( $class1, 'test_additional_base_additional' ) or $skip_taba = 1;
- can_ok( $class1, 'dbix_class_testcomponent' ) or $skip_tcomp = 1;
- can_ok( $class1, 'dbix_class_testrscomponent' ) or $skip_trscomp = 1;
+ can_ok( $class1, 'dbix_class_testcomponent' ) or $skip_tcomp = 1;
+ can_ok( $rsobj1, 'dbix_class_testrscomponent' ) or $skip_trscomp = 1;
can_ok( $class1, 'loader_test1_classmeth' ) or $skip_cmeth = 1;
can_ok( $rsobj1, 'loader_test1_rsmeth' ) or $skip_rsmeth = 1;
SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_tab;
+ skip "Pre-requisite test failed", 1 if $skip_tab;
is( $class1->test_additional_base, "test_additional_base",
"Additional Base method" );
- }
+ }
SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_tabo;
+ skip "Pre-requisite test failed", 1 if $skip_tabo;
is( $class1->test_additional_base_override,
- "test_left_base_override",
+ "test_left_base_override",
"Left Base overrides Additional Base method" );
}
SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_taba;
+ skip "Pre-requisite test failed", 1 if $skip_taba;
is( $class1->test_additional_base_additional, "test_additional",
"Additional Base can use Additional package method" );
}
- SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_tcomp;
+ SKIP: {
+ skip "Pre-requisite test failed", 1 if $skip_tcomp;
is( $class1->dbix_class_testcomponent,
- 'dbix_class_testcomponent works' );
- }
+ 'dbix_class_testcomponent works' );
+ }
- SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_trscomp;
+ SKIP: {
+ skip "Pre-requisite test failed", 1 if $skip_trscomp;
is( $rsobj1->dbix_class_testrscomponent,
- 'dbix_class_testrscomponent works' );
- }
+ 'dbix_class_testrscomponent works' );
+ }
- SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_cmeth;
+ SKIP: {
+ skip "Pre-requisite test failed", 1 if $skip_cmeth;
is( $class1->loader_test1_classmeth, 'all is well' );
- }
+ }
- SKIP: {
- skip "Pre-requisite test failed", 1 if $skip_rsmeth;
+ SKIP: {
+ skip "Pre-requisite test failed", 1 if $skip_rsmeth;
is( $rsobj1->loader_test1_rsmeth, 'all is still well' );
- }
+ }
}
my $obj4 = $rsobj4->find(123);
isa_ok( $obj4->fkid, $class3);
- my $obj3 = $rsobj3->find(1);
- my $rs_rel4 = $obj3->search_related('loader_test4s');
- isa_ok( $rs_rel4->first, $class4);
+ my $obj3 = $rsobj3->find(1);
+ my $rs_rel4 = $obj3->search_related('loader_test4s');
+ isa_ok( $rs_rel4->first, $class4);
# fk def in comments should not be parsed
my $obj5 = $rsobj5->find( id1 => 1, id2 => 1 );