getRepository('Project')->findBy(array('loco_number' => $loco_number, 'loco_type' => $loco_type), array('id' => 'DESC'), 1); foreach ($projs as $proj) { $sectionArr = array(); $thrust = GetCounters($proj->id, 310); $recuperation = GetCounters($proj->id, 311); $i = 0; foreach ($thrust as $thr) { $task = Task::Find($thr['tid']); if ($task) { $section = $task->getSection(); $sectionArr[] = $loco_number.$section->letter."/".$section->getSectionSubnumber(); $sectionArr[] = $thr['value']; $sectionArr[] = $recuperation[$i]['value']; } $i++; } $retarr[] = $sectionArr; } //var_dump($retarr); return $retarr; }