diff --git a/lib/DBIx/Class/ResultClass/HashRefInflator.pm b/lib/DBIx/Class/ResultClass/HashRefInflator.pm index 65d2adbbb..8d4ccc5ff 100644 --- a/lib/DBIx/Class/ResultClass/HashRefInflator.pm +++ b/lib/DBIx/Class/ResultClass/HashRefInflator.pm @@ -34,14 +34,22 @@ from a massive resultset, while skipping the creation of fancy result objects. Specifying this class as a C for a resultset will change C<< $rs->next >> to return a plain data hash-ref (or a list of such hash-refs if C<< $rs->all >> is used). -There are two ways of applying this class to a resultset: +There are three ways of applying this class to a resultset: =over =item * -Specify C<< $rs->result_class >> on a specific resultset to affect only that -resultset (and any chained off of it); or +Specify C<< $rs->result_class >> on a specific resultset to affect only +that resultset object (if you are going to immediately call C, +C, C, or another result method). + +=item * + +Specify C<< $rs->search({}, { result_class => '...' }) >> to affect this +resultset and any further resultset objects created from this one. Use +this if you are chaining additional calls to C and want the final +results to be hash-refs. =item * diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 0a6c002c7..47d674269 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1546,6 +1546,11 @@ that were originally loaded in the source class via L. Any overloaded methods in the original source class will not run. +Setting the result_class with this method will change the class only for +this resultset instance. Setting the result_class using the C +C<%attrs> hash will change the class for this resultset and any +resultset chained from this resultset. + =cut sub result_class { @@ -4665,6 +4670,12 @@ Set to 'update' for a SELECT ... FOR UPDATE or 'shared' for a SELECT ... FOR SHARED. If \$scalar is passed, this is taken directly and embedded in the query. +=head2 result_class + +Set the result_class attribute for this resultset and any resultset chained +from this resultset. This differs from using the L accessor: +The accessor is not chained and only applies to the current resultset. + =head1 PREFETCHING DBIx::Class supports arbitrary related data prefetching from multiple related