fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
152 stars 96 forks source link

Call to a member function count() #131

Closed osam closed 12 years ago

osam commented 12 years ago

The docs say:

$query = Model_Article::find()->where('category_id', 1)->order_by('date', 'desc');

// We want to know the total number of articles for pagination $number_of_articles = $query->count();

http://docs.fuelphp.com/packages/orm/crud.html

That gives ErrorException [ Error ]: Call to a member function count() on a non-object. However, this does work:

Model_Article::count();

WanWizard commented 12 years ago

That is very odd, where() and order_by() are methods of the Query object, and so is count().

Can you do a \Debug::dump($query) and see what it is (it should be an instance of \Orm\Query).

osam commented 12 years ago

It wasn't a bug. I had ->get(); at the end.