[Bast-commits] r7818 -
DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class
robkinyon at dev.catalyst.perl.org
robkinyon at dev.catalyst.perl.org
Fri Oct 23 20:16:12 GMT 2009
Author: robkinyon
Date: 2009-10-23 20:16:12 +0000 (Fri, 23 Oct 2009)
New Revision: 7818
Modified:
DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/Schema.pm
Log:
Added clean_resultset method
Modified: DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/ResultSource.pm 2009-10-23 20:10:17 UTC (rev 7817)
+++ DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/ResultSource.pm 2009-10-23 20:16:12 UTC (rev 7818)
@@ -818,6 +818,21 @@
);
}
+sub clean_resultset {
+ my $self = shift;
+ $self->throw_exception(
+ 'clean_resultset does not take any arguments. If you want another'.
+ 'resultset, call it on the schema instead.'
+ ) if scalar @_;
+
+ return $self->resultset_class->new(
+ $self,
+ {
+ %{$self->schema->default_resultset_attributes}
+ },
+ );
+}
+
=head2 source_name
=over 4
Modified: DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/Schema.pm 2009-10-23 20:10:17 UTC (rev 7817)
+++ DBIx-Class/0.08/branches/clean_resultset/lib/DBIx/Class/Schema.pm 2009-10-23 20:16:12 UTC (rev 7818)
@@ -548,6 +548,32 @@
return $self->source($moniker)->resultset;
}
+=head2 clean_resultset
+
+=over 4
+
+=item Arguments: $source_name
+
+=item Return Value: $resultset
+
+=back
+
+ my $rs = $schema->clean_resultset('DVD');
+
+Returns the L<DBIx::Class::ResultSet> object for the registered source
+name. Unlike L</resultset>, it will not set the default attributes for
+that source name. It I<will> set the schema's default resultset
+attributes.
+
+=cut
+
+sub clean_resultset {
+ my ($self, $moniker) = @_;
+ $self->throw_exception('clean_resultset() expects a source name')
+ unless defined $moniker;
+ return $self->source($moniker)->clean_resultset;
+}
+
=head2 sources
=over 4
More information about the Bast-commits
mailing list