count - Zend Framework. The best solution to calculate rows in the table -


I'm a newbie in ZF and some stupid questions:

What is the best solution to calculate rows Is it in the table if I work with the inherited object of the Zend_Db_Table_Abstract class?

I use the Quickstart tutorial () for my first web application, so if I want to calculate the count of rows in the table in the controller, then the simplest solution would be something like this:

  $ guestbooks = new Default_Model_GuestBook (); $ Count = count ($ guestbooks-> Fatch ALL ());  

But I do not think fetchAll () is the best solution for calculating the rows in the table because the GuestBook table can actually be very large that something much easier and simpler Is it possible to use anything?

I found manually that it is possible to work directly with DB adapter (such as $ db-> query ("SELECT COUNT (*) FROM GuestBook"); but in the Quickstart tutorial, Has not been found in the controller and I do not want to make it for just a simple action.

Will be waiting for suggestions!

Thank you

Your model is already a DB adapter because it is with DB Works. You can access the DB adapter using the getAdapter () method.

  $ questbooks-> GetAdapter () - & gt; Query ("from selected COUNT (*) guestbook");  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -