Exemplo n.º 1
0
 public function getRowCount(Collection $collection = null)
 {
     if (isset($collection)) {
         return $collection->count(true);
     }
     if (!isset($this->_rowCount)) {
         $sql = 'SELECT COUNT(*) AS count FROM ' . $this->_tableName;
         $connection = Db::getInstance()->getConnection();
         $statement = $connection->prepare($sql);
         $statement->execute();
         $result = $statement->fetch(PDO::FETCH_ASSOC);
         $this->_rowCount = $result['count'];
     }
     return $this->_rowCount;
 }