X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;fp=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;h=7f72358ce649e431930b945b21d57caf27d619b7;hb=9deda071795f057326346a73c9df279523779416;hp=42e2fa43ccce6bf428c5843b3b8923c579259743;hpb=289496709ffe36f6e233811ec3f4b28b8dc1bc5f;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 42e2fa4..7f72358 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -24,7 +24,7 @@ use Try::Tiny; use DBIx::Class (); use namespace::clean; -our $VERSION = '0.07001'; +our $VERSION = '0.08000'; __PACKAGE__->mk_group_ro_accessors('simple', qw/ schema @@ -132,7 +132,7 @@ overwriting a dump made with an earlier version. The option also takes a hashref: - naming => { relationships => 'v7', monikers => 'v7' } + naming => { relationships => 'v8', monikers => 'v8' } The keys are: @@ -194,6 +194,11 @@ transition instead of just being lowercased, so C becomes C. If you don't have any CamelCase table or column names, you can upgrade without breaking any of your code. +=item v8 + +This mode tries harder to not have collisions between column accessors and +belongs_to relationship accessors. + =back Dynamic schemas will always default to the 0.04XXX relationship names and won't @@ -202,10 +207,10 @@ and singularization put this in your C file: __PACKAGE__->naming('current'); -Or if you prefer to use 0.07XXX features but insure that nothing breaks in the +Or if you prefer to use 0.08XXX features but insure that nothing breaks in the next major version upgrade: - __PACKAGE__->naming('v7'); + __PACKAGE__->naming('v8'); =head2 generate_pod @@ -490,7 +495,7 @@ L. =cut -my $CURRENT_V = 'v7'; +my $CURRENT_V = 'v8'; my @CLASS_ARGS = qw( schema_base_class result_base_class additional_base_classes @@ -1006,6 +1011,15 @@ sub _relbuilder { $self->relationship_attrs, ); } + elsif ($self->naming->{relationships} eq 'v6') { + require DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07; + return $self->{relbuilder} ||= DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_07->new ( + $self->schema, + $self->inflect_plural, + $self->inflect_singular, + $self->relationship_attrs, + ); + } return $self->{relbuilder} ||= DBIx::Class::Schema::Loader::RelBuilder->new ( $self->schema,