as_subselect_rs new resultset bugfix #105
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using ->pager->count on complicated resultset this error pops up:
Single parameters to new() must be a HASH ref at /usr/lib64/perl5/site_perl/5.12.3/x86_64-linux/Moose/Object.pm line 30 Moose::Object::BUILDARGS('PODirect::Schema::ResultSet::user', 'DBIx::Class::ResultSource::Table=HASH(0x9d5e0f0)') called at /usr/lib64/perl5/site_perl/5.12.3/MooseX/NonMoose/Meta/Role/Class.pm line 154 MySchema::Schema::ResultSet::user::new('PODirect::Schema::ResultSet::user', 'DBIx::Class::ResultSource::Table=HASH(0x9d5e0f0)') called at /usr/lib64/perl5/site_perl/5.12.3/DBIx/Class/ResultSet.pm line 3389 DBIx::Class::ResultSet::as_subselect_rs('PODirect::Schema::ResultSet::user=HASH(0x7f32b0acac30)') called at /usr/lib64/perl5/site_perl/5.12.3/DBIx/Class/ResultSet.pm line 1766 DBIx::Class::ResultSet::_count_subq_rs('PODirect::Schema::ResultSet::user=HASH(0x7f32b0abf518)', 'HASH(0x7f32b0acc820)') called at /usr/lib64/perl5/site_perl/5.12.3/DBIx/Class/ResultSet.pm line 1604 DBIx::Class::ResultSet::count('PODirect::Schema::ResultSet::user=HASH(0x7f32b0abf518)') called at /usr/lib64/perl5/site_perl/5.12.3/DBIx/Class/ResultSet.pm line 2536 DBIx::Class::ResultSet::__ANON__ at /usr/lib64/perl5/site_perl/5.12.3/DBIx/Class/ResultSet/Pager.pm line 15 DBIx::Class::ResultSet::Pager::_total_entries_accessor('DBIx::Class::ResultSet::Pager=HASH(0x7f32b0acc178)') called at /usr/lib64/perl5/vendor_perl/5.12.3/Data/Page.pm line 50 Data::Page::total_entries('DBIx::Class::ResultSet::Pager=HASH(0x7f32b0acc178)') called at test.pl line 85
Sample code:
my $s = $ex->search_rs({ "category.category" => 'test' }, { 'page' => 1, 'rows' => 10, 'prefetch' => [ { 'table1' => [ { 'table2' => [] } ] } ], });
This small fix resolves the problem.