There are various ways to get the count of a record collection. Doctrine automatically creates a count query for you when you call the ->count() function on a query object or Table instance.
If for instance you would like to know the total amount of users and the amount of users created in the current year, you could go about it as follows:
$query = Doctrine_Query::create()
->from('sfGuardUser');
// alternative query retrieval
// $query = sfGuardUserTable::getInstance()->createQuery();
// all users
$totalUsers = $query->count();
// users created this year
$query->where('YEAR(created_at) = ?', date('Y'));
$totalUsersThisYear = $query->count();