X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=9a2e061a9b4b354b8e59072d10b05e5ed47a6dba;hb=db4900f2f4608671ef43b116d7ba5da56a928d3f;hp=e3c2b80cfaa01024ca10a480a8b67bb113bf6237;hpb=e522f14ae09fb8cceb31a0fd58e7ceea4de19a93;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index e3c2b80..9a2e061 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -14,7 +14,7 @@ __PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns _columns _primaries _unique_constraints name resultset_attributes schema from _relationships column_info_from_storage source_info/); -__PACKAGE__->mk_group_accessors('inherited' => qw/resultset_class +__PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class result_class/); __PACKAGE__->mk_group_ro_accessors('simple' => qw/source_name/); @@ -175,7 +175,7 @@ sub add_columns { return $self; } -*add_column = \&add_columns; +sub add_column { shift->add_columns(@_); } # DO NOT CHANGE THIS TO GLOB =head2 has_column @@ -286,7 +286,7 @@ sub remove_columns { $self->_ordered_columns(\@remaining); } -*remove_column = \&remove_columns; +sub remove_column { shift->remove_columns(@_); } # DO NOT CHANGE THIS TO GLOB =head2 set_primary_key @@ -771,6 +771,8 @@ sub resolve_condition { #warn %ret; } elsif (!defined $for) { # undef, i.e. "no object" $ret{$k} = undef; + } elsif (ref $as eq 'HASH') { # reverse hashref + $ret{$v} = $as->{$k}; } elsif (ref $as) { # reverse object $ret{$v} = $as->get_column($k); } elsif (!defined $as) { # undef, i.e. "no reverse object" @@ -874,9 +876,13 @@ sub resolve_prefetch { $self->throw_exception( "Can't prefetch has_many ${pre} (join cond too complex)") unless ref($rel_info->{cond}) eq 'HASH'; + #my @col = map { (/^self\.(.+)$/ ? ("${as_prefix}.$1") : ()); } + # values %{$rel_info->{cond}}; + $collapse->{".${as_prefix}${pre}"} = [ $rel_source->primary_columns ]; + # action at a distance. prepending the '.' allows simpler code + # in ResultSet->_collapse_result my @key = map { (/^foreign\.(.+)$/ ? ($1) : ()); } keys %{$rel_info->{cond}}; - $collapse->{"${as_prefix}${pre}"} = \@key; my @ord = (ref($rel_info->{attrs}{order_by}) eq 'ARRAY' ? @{$rel_info->{attrs}{order_by}} : (defined $rel_info->{attrs}{order_by} @@ -957,7 +963,9 @@ L, and set it here. $source->resultset_attributes({ order_by => [ 'id' ] }); -Specify here any attributes you wish to pass to your specialised resultset. +Specify here any attributes you wish to pass to your specialised +resultset. For a full list of these, please see +L. =cut @@ -1032,3 +1040,4 @@ You may distribute this code under the same terms as Perl itself. =cut +1;