0

I've a application which Services to retrieve object from Doctrine 2 repositories.

I'm used to Zend_Paginator, and, well I know that there is adapter for it.

However, I'm wondering where and how should I implement system.

let's say I've such methods:

public function getLatestArticles();
public function getReviewedArticles();
public function getSubmitedArticles();

Then, in use, in my controller, I'll have :

public function listAction()
{ 
    $which = $this->_getParam('which', 'latest');
    switch($which)
    {
       case 'latest':
        $articles = $service->getLatestArticles();
    }
}

But let's say now, I'd like to have a pagination.

How would you implement this?

Note that for doing pagination I need to do two things, get the COUNT() then, slice the result. I can easily slice result by adding page or range arguments in my service method, but how will I count?

I'm stuck, as I can't find the best way to do, maybe my system is not adapted and I'm looking at the right thing.

Any feedbacks & help will be much appreciated.

JohnT
  • 967
  • 2
  • 16
  • 30

1 Answers1

0

I think you're looking for this answer: Doctrine2 large collections

Community
  • 1
  • 1
Tomas Dermisek
  • 778
  • 1
  • 8
  • 14
  • hi, thank your for answer, however it is a bit different in my case, because this question is about loading the relationship, which is actually a problem I have too, but I think, it is a different implementation for a different problem, but I'll try to look at it to see if I can have inspiration. – JohnT Jun 11 '11 at 13:26