diff --git a/frm/Model.php b/frm/Model.php index d3b0d40..756d51f 100644 --- a/frm/Model.php +++ b/frm/Model.php @@ -97,4 +97,13 @@ class Model { } return false; } + + public function count() { + $child_model_name = get_called_class(); + $model = new $child_model_name; + $stmt = $this->app->dbh->prepare( 'SELECT count(id) FROM ' . $model->_table_name ); + $model = null; + $stmt->execute(); + return (int) $stmt->fetchColumn(); + } } \ No newline at end of file