1
我想使用教義分頁類來獲取一些任務。學說分頁器迭代是一個1對象的數組
$qb = $this->getEntityManager()
->createQueryBuilder()
->select('DISTINCT task, priority, company, invoice')
->addSelect('priority.id as priority_id')
->from('TekniqSD4Bundle:task', 'task')
->leftJoin('task.slips', 'slips')
->leftJoin('task.comments', 'comments')
->leftJoin('task.files', 'files')
->leftJoin('task.steps', 'steps')
->leftJoin('task.status', 'status')
->join('task.invoice', 'invoice')
->join('task.priority', 'priority')
->join('invoice.company', 'company');
$query = $qb->getQuery()
->setMaxResults(2)
->setFirstResult($offset);
$paginator = new Paginator($query, true);
foreach($paginator as $task){
var_dump($task); //this spits out an array containing 1 task
}
我的問題是,爲什麼$任務數組?
我甚至沒有意識到那裏,謝謝你好,先生。 – Trololololol 2013-02-27 21:09:38