From 3056d9daa5829bdafb71026daa977d6f99c3f182 Mon Sep 17 00:00:00 2001 From: doctrine Date: Sun, 23 Jul 2006 21:56:21 +0000 Subject: [PATCH] new method: Doctrine_Table::count(), returns the number of records in specified table --- Doctrine/Hydrate.php | 2 ++ Doctrine/Table.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Doctrine/Hydrate.php b/Doctrine/Hydrate.php index 9a6085986..fa70a21a5 100644 --- a/Doctrine/Hydrate.php +++ b/Doctrine/Hydrate.php @@ -1,4 +1,6 @@ columns; } + /** + * count + * + * @return integer + */ + public function count() { + $a = $this->session->getDBH()->query("SELECT COUNT(1) FROM ".$this->tableName)->fetch(PDO::FETCH_NUM); + return current($a); + } /** * @return Doctrine_Query a Doctrine_Query object */