Revision history for Perl extension DBIx::Class::Schema::Loader
+ - add schema_components option
- sort relationships so they always come out in the same order
- add rel_name_map option
- fix the decimal data type for MS Access over ODBC
- generate Schema/ResultBase.pm and Schema/ResultSetBase.pm
- remove additional warnings skip in t/22dump.t for ActivePerl on Win32
- make 23dumpmore.t auto cleanup and remove dump warnings
+ - generate POD for schema class with class list
- Relationships
- Re-scan relations/tables after initial relation setup to find
additional_base_classes
left_base_classes
components
+ schema_components
skip_relationships
skip_load_external
moniker_map
List of additional classes which all of your table classes will use.
+=head2 schema_components
+
+List of components to load into the Schema class.
+
=head2 components
-List of additional components to be loaded into all of your table
+List of additional components to be loaded into all of your Result
classes. A good example would be
L<InflateColumn::DateTime|DBIx::Class::InflateColumn::DateTime>
my $CURRENT_V = 'v7';
my @CLASS_ARGS = qw(
- schema_base_class result_base_class additional_base_classes
- left_base_classes additional_classes components result_roles
+ schema_components schema_base_class result_base_class
+ additional_base_classes left_base_classes additional_classes components
+ result_roles
);
# ensure that a peice of object data is a valid arrayref, creating
if ((not defined $self->use_moose) || (not $self->use_moose))
&& ((defined $self->result_roles) || (defined $self->result_roles_map));
- $self->_ensure_arrayref(qw/additional_classes
+ $self->_ensure_arrayref(qw/schema_components
+ additional_classes
additional_base_classes
left_base_classes
components
$schema_text .= qq|use strict;\nuse warnings;\n\nuse base '$schema_base_class';\n\n|;
}
+ my @schema_components = @{ $self->schema_components || [] };
+
+ if (@schema_components) {
+ my $schema_components = dump @schema_components;
+ $schema_components = "($schema_components)" if @schema_components == 1;
+
+ $schema_text .= "__PACKAGE__->load_components${schema_components};\n\n";
+ }
+
if ($self->use_namespaces) {
$schema_text .= qq|__PACKAGE__->load_namespaces|;
my $namespace_options;
--- /dev/null
+package DBIx::Class::TestSchemaComponent;
+
+sub dbix_class_testschemacomponent { 'dbix_class_testschemacomponent works' }
+
+1;
--- /dev/null
+package TestSchemaComponentFQN;
+
+sub testschemacomponent_fqn { 'TestSchemaComponentFQN works' }
+
+1;
$num_rescans++ if $self->{vendor} eq 'Firebird';
plan tests => @connect_info *
- (209 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
+ (210 + $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];
qr/^(?:\S+\.)?(?:(?:$self->{vendor}|extra)[_-]?)?loader[_-]?test[0-9]+(?!.*_)/i,
result_namespace => RESULT_NAMESPACE,
resultset_namespace => RESULTSET_NAMESPACE,
+ schema_components => [ 'TestSchemaComponent', '+TestSchemaComponentFQN' ],
additional_classes => 'TestAdditional',
additional_base_classes => 'TestAdditionalBase',
left_base_classes => [ qw/TestLeftBase/ ],
is_deeply $schema_resultset_namespace, RESULTSET_NAMESPACE,
'resultset_namespace set correctly on Schema';
+ like $schema_code,
+qr/\n__PACKAGE__->load_components\("TestSchemaComponent", "\+TestSchemaComponentFQN"\);\n\n__PACKAGE__->load_namespaces/,
+ 'schema_components works';
+
my @columns_lt2 = $class2->columns;
is_deeply( \@columns_lt2, [ qw/id dat dat2 set_primary_key can dbix_class_testcomponent dbix_class_testcomponentmap testcomponent_fqn meta test_role_method test_role_for_map_method crumb_crisp_coating/ ], "Column Ordering" );