From d6cee3092409769c769a46fcae6957c3d81345be Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Wed, 25 Mar 2015 15:47:15 +0200 Subject: [PATCH] Bug 13905 - Wrapping DBIx count inside Koha Object DBIx::Class::ResultSet has a handy method count() to see how many results this prepared ResultSet would return. This is hidden by the Koha::Object. This patch adds a wrapper for the count() method inside the Koha::Object, so it is nicely available for all subclasses. --- Koha/Object.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Koha/Object.pm b/Koha/Object.pm index a77eb5c..bc3d60a 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -207,6 +207,17 @@ sub id { return $id; } +=head3 $object->count(); + +Returns how many objects like this are in the DB. + +=cut + +sub count { + my ($self) = @_; + return $self->_result()->count(); +} + =head3 $object->_result(); Returns the internal DBIC Row object -- 1.7.9.5