views:

35

answers:

1

Hi,

The title says it all... What is the fastest way to count all the records of a table using Doctrine ORM?

I don't need the individual records of the table. I just need the total number of records in the table.

Thanks!

+4  A: 

The fastest is likely to bypass Doctrine and use raw SQL, but you can do:

Doctrine::getTable('tablename')->count();

Also see:

Gordon
In a project that has the privilege of using Doctrine, I'd recommend to avoid raw SQL where ever it's possible. The "countable" Interface of Doctrine_Table is the way to go here.
Techpriester