X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=c773e192f6d64eaaff3e1e2faadab9cc81500540;hp=6599a4a67586d18909d62ea5929dc2aeda67bbfa;hb=fb13a49f;hpb=3d4c5a8439e2c5f6b74e6c8f52117ececd9e20fa diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 6599a4a..c773e19 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -94,7 +94,7 @@ You can retrieve the result source at runtime in the following ways: $schema->source($source_name); -=item From a Row object: +=item From a Result object: $row->result_source; @@ -133,7 +133,7 @@ sub new { =item Arguments: @columns -=item Return value: The ResultSource object +=item Return Value: L<$result_source|/new> =back @@ -146,7 +146,7 @@ pairs, uses the hashref as the L for that column. Repeated calls of this method will add more columns, not replace them. The column names given will be created as accessor methods on your -L objects. You can change the name of the accessor +L objects. You can change the name of the accessor by supplying an L in the column_info hash. If a column name beginning with a plus sign ('+col1') is provided, the @@ -299,7 +299,7 @@ L. =item Arguments: $colname, \%columninfo? -=item Return value: 1/0 (true/false) +=item Return Value: 1/0 (true/false) =back @@ -343,7 +343,7 @@ sub add_column { shift->add_columns(@_); } # DO NOT CHANGE THIS TO GLOB =item Arguments: $colname -=item Return value: 1/0 (true/false) +=item Return Value: 1/0 (true/false) =back @@ -364,7 +364,7 @@ sub has_column { =item Arguments: $colname -=item Return value: Hashref of info +=item Return Value: Hashref of info =back @@ -412,9 +412,9 @@ sub column_info { =over -=item Arguments: None +=item Arguments: none -=item Return value: Ordered list of column names +=item Return Value: Ordered list of column names =back @@ -438,7 +438,7 @@ sub columns { =item Arguments: \@colnames ? -=item Return value: Hashref of column name/info pairs +=item Return Value: Hashref of column name/info pairs =back @@ -512,7 +512,7 @@ sub columns_info { =item Arguments: @colnames -=item Return value: undefined +=item Return Value: not defined =back @@ -530,7 +530,7 @@ broken result source. =item Arguments: $colname -=item Return value: undefined +=item Return Value: not defined =back @@ -568,7 +568,7 @@ sub remove_column { shift->remove_columns(@_); } # DO NOT CHANGE THIS TO GLOB =item Arguments: @cols -=item Return value: undefined +=item Return Value: not defined =back @@ -602,9 +602,9 @@ sub set_primary_key { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: Ordered list of primary column names +=item Return Value: Ordered list of primary column names =back @@ -641,7 +641,7 @@ will be applied to the L of each L =item Arguments: $sequence_name -=item Return value: undefined +=item Return Value: not defined =back @@ -664,7 +664,7 @@ sub sequence { =item Arguments: $name?, \@colnames -=item Return value: undefined +=item Return Value: not defined =back @@ -730,7 +730,7 @@ sub add_unique_constraint { =item Arguments: @constraints -=item Return value: undefined +=item Return Value: not defined =back @@ -782,7 +782,7 @@ sub add_unique_constraints { =item Arguments: \@colnames -=item Return value: Constraint name +=item Return Value: Constraint name =back @@ -816,9 +816,9 @@ sub name_unique_constraint { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: Hash of unique constraint data +=item Return Value: Hash of unique constraint data =back @@ -840,9 +840,9 @@ sub unique_constraints { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: Unique constraint names +=item Return Value: Unique constraint names =back @@ -866,7 +866,7 @@ sub unique_constraint_names { =item Arguments: $constraintname -=item Return value: List of constraint columns +=item Return Value: List of constraint columns =back @@ -894,7 +894,7 @@ sub unique_constraint_columns { =item Arguments: $callback_name | \&callback_code -=item Return value: $callback_name | \&callback_code +=item Return Value: $callback_name | \&callback_code =back @@ -965,9 +965,9 @@ sub _invoke_sqlt_deploy_hook { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: $resultset +=item Return Value: L<$resultset|DBIx::Class::ResultSet> =back @@ -984,7 +984,7 @@ but is cached from then on unless resultset_class changes. =item Arguments: $classname -=item Return value: $classname +=item Return Value: $classname =back @@ -1010,7 +1010,7 @@ exists. =item Arguments: \%attrs -=item Return value: \%attrs +=item Return Value: \%attrs =back @@ -1046,7 +1046,7 @@ sub resultset { =over 4 -=item Arguments: None +=item Arguments: none =item Result value: $name @@ -1082,9 +1082,9 @@ its class name. =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: FROM clause +=item Return Value: FROM clause =back @@ -1102,9 +1102,9 @@ sub from { die 'Virtual method!' } =over 4 -=item Arguments: $schema +=item Arguments: L<$schema?|DBIx::Class::Schema> -=item Return value: A schema object +=item Return Value: L<$schema|DBIx::Class::Schema> =back @@ -1138,17 +1138,15 @@ sub schema { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: A Storage object +=item Return Value: L<$storage|DBIx::Class::Storage> =back $source->storage->debug(1); -Returns the storage handle for the current schema. - -See also: L +Returns the L for the current schema. =cut @@ -1158,13 +1156,13 @@ sub storage { shift->schema->storage; } =over 4 -=item Arguments: $relname, $related_source_name, \%cond, [ \%attrs ] +=item Arguments: $rel_name, $related_source_name, \%cond, \%attrs? -=item Return value: 1/true if it succeeded +=item Return Value: 1/true if it succeeded =back - $source->add_relationship('relname', 'related_source', $cond, $attrs); + $source->add_relationship('rel_name', 'related_source', $cond, $attrs); L describes a series of methods which create pre-defined useful types of relationships. Look there first @@ -1284,9 +1282,9 @@ sub add_relationship { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: List of relationship names +=item Return Value: L<@rel_names|DBIx::Class::Relationship> =back @@ -1304,14 +1302,14 @@ sub relationships { =over 4 -=item Arguments: $relname +=item Arguments: L<$rel_name|DBIx::Class::Relationship> -=item Return value: Hashref of relation data, +=item Return Value: L<\%rel_data|DBIx::Class::Relationship::Base/add_relationship> =back Returns a hash of relationship information for the specified relationship -name. The keys/values are as specified for L. +name. The keys/values are as specified for L. =cut @@ -1324,9 +1322,9 @@ sub relationship_info { =over 4 -=item Arguments: $rel +=item Arguments: L<$rel_name|DBIx::Class::Relationship> -=item Return value: 1/0 (true/false) +=item Return Value: 1/0 (true/false) =back @@ -1343,9 +1341,9 @@ sub has_relationship { =over 4 -=item Arguments: $relname +=item Arguments: L<$rel_name|DBIx::Class::Relationship> -=item Return value: Hashref of relationship data +=item Return Value: L<\%rel_data|DBIx::Class::Relationship::Base/add_relationship> =back @@ -1566,9 +1564,9 @@ sub pk_depends_on { # having already been inserted. Takes the name of the relationship and a # hashref of columns of the related object. sub _pk_depends_on { - my ($self, $relname, $rel_data) = @_; + my ($self, $rel_name, $rel_data) = @_; - my $relinfo = $self->relationship_info($relname); + my $relinfo = $self->relationship_info($rel_name); # don't assume things if the relationship direction is specified return $relinfo->{attrs}{is_foreign_key_constraint} @@ -1583,7 +1581,7 @@ sub _pk_depends_on { # assume anything that references our PK probably is dependent on us # rather than vice versa, unless the far side is (a) defined or (b) # auto-increment - my $rel_source = $self->related_source($relname); + my $rel_source = $self->related_source($rel_name); foreach my $p ($self->primary_columns) { if (exists $keyhash->{$p}) { @@ -1611,7 +1609,7 @@ our $UNRESOLVABLE_CONDITION = \ '1 = 0'; # list of non-triviail values (notmally conditions) returned as a part # of a joinfree condition hash sub _resolve_condition { - my ($self, $cond, $as, $for, $relname) = @_; + my ($self, $cond, $as, $for, $rel_name) = @_; my $obj_rel = !!blessed $for; @@ -1622,7 +1620,7 @@ sub _resolve_condition { self_alias => $obj_rel ? $as : $for, foreign_alias => $relalias, self_resultsource => $self, - foreign_relname => $relname || ($obj_rel ? $as : $for), + foreign_relname => $rel_name || ($obj_rel ? $as : $for), self_rowobj => $obj_rel ? $for : undef }); @@ -1631,7 +1629,7 @@ sub _resolve_condition { # FIXME sanity check until things stabilize, remove at some point $self->throw_exception ( - "A join-free condition returned for relationship '$relname' without a row-object to chain from" + "A join-free condition returned for relationship '$rel_name' without a row-object to chain from" ) unless $obj_rel; # FIXME another sanity check @@ -1641,7 +1639,7 @@ sub _resolve_condition { first { $_ !~ /^\Q$relalias.\E.+/ } keys %$joinfree_cond ) { $self->throw_exception ( - "The join-free condition returned for relationship '$relname' must be a hash " + "The join-free condition returned for relationship '$rel_name' must be a hash " .'reference with all keys being valid columns on the related result source' ); } @@ -1658,7 +1656,7 @@ sub _resolve_condition { } # see which parts of the joinfree cond are conditionals - my $relcol_list = { map { $_ => 1 } $self->related_source($relname)->columns }; + my $relcol_list = { map { $_ => 1 } $self->related_source($rel_name)->columns }; for my $c (keys %$joinfree_cond) { my ($colname) = $c =~ /^ (?: \Q$relalias.\E )? (.+)/x; @@ -1735,14 +1733,14 @@ sub _resolve_condition { elsif (ref $cond eq 'ARRAY') { my (@ret, $crosstable); for (@$cond) { - my ($cond, $crosstab) = $self->_resolve_condition($_, $as, $for, $relname); + my ($cond, $crosstab) = $self->_resolve_condition($_, $as, $for, $rel_name); push @ret, $cond; $crosstable ||= $crosstab; } return wantarray ? (\@ret, $crosstable) : \@ret; } else { - $self->throw_exception ("Can't handle condition $cond for relationship '$relname' yet :("); + $self->throw_exception ("Can't handle condition $cond for relationship '$rel_name' yet :("); } } @@ -1857,9 +1855,9 @@ sub _resolve_prefetch { =over 4 -=item Arguments: $relname +=item Arguments: $rel_name -=item Return value: $source +=item Return Value: $source =back @@ -1890,9 +1888,9 @@ sub related_source { =over 4 -=item Arguments: $relname +=item Arguments: $rel_name -=item Return value: $classname +=item Return Value: $classname =back @@ -1912,9 +1910,9 @@ sub related_class { =over 4 -=item Arguments: None +=item Arguments: none -=item Return value: $source_handle +=item Return Value: L<$source_handle|DBIx::Class::ResultSourceHandle> =back @@ -2031,7 +2029,7 @@ Creates a new ResultSource object. Not normally called directly by end users. =item Arguments: 1/0 (default: 0) -=item Return value: 1/0 +=item Return Value: 1/0 =back