result_namespace
resultset_namespace
default_resultset_class
+ schema_base_class
+ result_base_class
db_schema
_tables
As L</inflect_plural> above, but for singularizing relationship names.
Default behavior is to utilize L<Lingua::EN::Inflect::Number/to_S>.
+=head2 schema_base_class
+
+Base class for your schema classes. Defaults to 'DBIx::Class::Schema'.
+
+=head2 result_base_class
+
+Base class for your table classes (aka result classes). Defaults to 'DBIx::Class'.
+
=head2 additional_base_classes
List of additional base classes all of your table classes will use.
my $target_dir = $self->dump_directory;
my $schema_class = $self->schema_class;
+ my $schema_base_class = $self->schema_base_class || 'DBIx::Class::Schema';
croak "Must specify target directory for dumping!" if ! $target_dir;
my $schema_text =
qq|package $schema_class;\n\n|
. qq|use strict;\nuse warnings;\n\n|
- . qq|use base 'DBIx::Class::Schema';\n\n|;
+ . qq|use base '$schema_base_class';\n\n|;
if ($self->use_namespaces) {
$self->_write_classfile($schema_class, $schema_text);
+ my $result_base_class = $self->result_base_class || 'DBIx::Class';
+
foreach my $src_class (sort keys %{$self->{_dump_storage}}) {
my $src_text =
qq|package $src_class;\n\n|
. qq|use strict;\nuse warnings;\n\n|
- . qq|use base 'DBIx::Class';\n\n|;
+ . qq|use base '$result_base_class';\n\n|;
$self->_write_classfile($src_class, $src_text);
}
result_namespace => '+DBICTest::DumpMore::1::Res',
resultset_namespace => 'RSet',
default_resultset_class => 'RSetBase',
+ result_base_class => 'My::ResultBaseClass',
+ schema_base_class => 'My::SchemaBaseClass',
},
error => '',
warnings => [
qr/result_namespace => '\+DBICTest::DumpMore::1::Res'/,
qr/resultset_namespace => 'RSet'/,
qr/default_resultset_class => 'RSetBase'/,
+ qr/use base 'My::SchemaBaseClass'/,
],
'Res/Foo' => [
qr/package DBICTest::DumpMore::1::Res::Foo;/,
+ qr/use base 'My::ResultBaseClass'/,
qr/->set_primary_key/,
qr/1;\n$/,
],
'Res/Bar' => [
qr/package DBICTest::DumpMore::1::Res::Bar;/,
+ qr/use base 'My::ResultBaseClass'/,
qr/->set_primary_key/,
qr/1;\n$/,
],