I doubt those exact lines work differently in your controller.
There is nothing wrong with what it is returning. Because you are calling get a second time, there is only one item in the array.
Your code should look like this:
Code:
$p = new Report();
$p->get();
return count($p->all);
EDIT: Made a slight change to count ->all explicitly.[/quote]
Sorry, that was a typo in my post, I should have copied/pasted.
My code is indeed:
Code:
$p = new Report();
$p->get();
return count($p->all);
It will only give me the first report by date (this auto sort is spec'd in the model).
However in a controller, it gives me all of them.
I've even made a new helper and a new controller just to see, and with different names for the objects. Same deal.
Another thing I tried is that a get where works in the helper:
ex:
Code:
$p->where('id', 4)->get();
I can change that number, and I always get the correct report. But the minute a get should return more than one, and it's in a helper, it just spits out the first report in line.