From: Rafael Kitover Date: Tue, 25 Oct 2011 20:56:48 +0000 (-0400) Subject: use connection hack only for schema_base_class X-Git-Tag: 0.07011~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a1781f7f4662ebf849773539acbe59eb85a1d0d0;p=dbsrgits%2FDBIx-Class-Schema-Loader.git use connection hack only for schema_base_class Use the horrible mro hack in ::Loader::connection only if schema_base_class and/or schema_components were defined. Add warnings to the POD for these options that dynamic schemas cannot define a connection method. --- diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 78b0507..1c7b649 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -244,10 +244,9 @@ sub connection { if $temp_loader->schema_base_class; $self->load_components(@components); - } - # This hack is necessary if we changed @ISA of $self through ->load_components. - { + # This hack is necessary because we changed @ISA of $self through + # ->load_components. no warnings 'redefine'; local *connection = subname __PACKAGE__.'::connection' => sub { @@ -257,6 +256,9 @@ sub connection { $self = $self->connection(@_); } + else { + $self = $self->next::method(@_); + } my $class = ref $self || $self; if(!$class->_loader_invoked) { diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 1633327..b2c99c7 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -545,6 +545,19 @@ Default behavior is to utilize L. Base class for your schema classes. Defaults to 'DBIx::Class::Schema'. +B: if you define schema_base_class for a dynamic schema, you cannot +define a L method in your schema +class, it must be in the schema base class, due to the limits of L. + +=head2 schema_components + +List of components to load into the Schema class. + +B: if you define schema_components for a dynamic schema, you cannot +define a L method in your schema +class, it must be in L or a component, due to the limits of +L. + =head2 result_base_class Base class for your table classes (aka result classes). Defaults to @@ -563,10 +576,6 @@ that need to be leftmost. 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 Result