Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find method 'count' #4

Open
dsteinbrunner opened this issue Jun 14, 2012 · 1 comment
Open

Cannot find method 'count' #4

dsteinbrunner opened this issue Jun 14, 2012 · 1 comment

Comments

@dsteinbrunner
Copy link
Contributor

I ran into issues with count when working with result sets. I create a test which can be put at the bottom of 09-resultset.t:

count after creation

{
my $result = Wine->result();
is $result->count, 3;
}

This fails till I simplify the count method to the following:

sub count {
my $self = shift;
my $results = $self->_load_results;
return scalar @$results;
}

Yann through personal conversation confirms that the count method on $self->class will not work in a normal install. This is due to it expecting a Six Apart specific subclass and that the resultset count should be refactored so that $self->class->can('count') is a condition that is factored in.

@sewi-cpan
Copy link

BaseObject.pm has a section...

sub update         { shift->_proxy( 'update',         @_ ) }
sub insert         { shift->_proxy( 'insert',         @_ ) }
sub replace        { shift->_proxy( 'replace',        @_ ) }
sub fetch_data     { shift->_proxy( 'fetch_data',     @_ ) }
sub uncache_object { shift->_proxy( 'uncache_object', @_ ) }

It's just missing

sub count          { shift->_proxy( 'count',          @_ ) }

Also the others (count_group_by, sum_group_by, avg_group_by, max_group_by, remove_all) would be also very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants