Hi every:
I'm trying to paginate. For this in my model I do that:

Job.class.php
--------------
class Job extends BaseJob
{
        static public function obtenerUltimosTrabajos($current = 1, $limit) {
                $last1day = date('Y-m-d H:i:s', time() - 86400);
                $pager = new Doctrine_Pager(
                Doctrine_Query::create()
                  ->select('j.*, (j.endtime - j.starttime) as duration, 
s.jobstatuslong, c.name, p.name, f.*')
                  ->from('Job j')
                  ->leftJoin('j.Status s')
                  ->leftJoin('j.Client c')
                  ->leftJoin('j.Pool p')
                  ->leftJoin('j.Fileset f')
                  ->where("j.endtime < ?", $last1day)
                  ->addWhere("j.jobstatus IN ('T', 'E', 'e', 'f', 'A')")
                  ->orderBy('j.starttime, j.jobid')
                  ->addGroupBy('j.jobid, j.job, j.name, j.type, j.level, 
j.clientid, 
j.jobstatus, j.jobtdate, j.volsessionid,
                             j.volsessiontime, j.jobfiles, j.jobbytes, 
j.readbytes, j.joberrors, j.jobmissingfiles, j.poolid,
                             j.filesetid, j.purgedfiles, j.hasbase, 
j.priorjobid, j.schedtime, j.realendtime, s.jobstatus,
                             s.jobstatuslong, c.clientid, c.name, 
p.poolid, p.name, f.filesetid, f.fileset, f.md5, f.createtime,
                             j.starttime, j.endtime'), $current, $limit);
                return $pager->execute();
        }
}

Then in my controller:

actions.class.php
-----------------
public function executeIndex(sfWebRequest $request) {
  $limit = sfConfig::get('app_job_per_page');
  $this->results = Job::obtenerUltimosTrabajos('', $limit);
}

Where app_job_per_page takes 10 as value (seted up in app.yml). When I 
execute the method I get always 25 (by default) records, why? In this 
scenario how I can paginate using DoctrinePager methods like 
getFirstPage(), getLastPage() and some others? I try directly from 
$results var but this show me an error because $results contains a 
Doctrine Collection.

Regards,
-- 
Ing. Reynier Pérez Mira

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to