public function executeIndex(sfWebRequest $request) { $staffs = Staff::fetchAllIds(); $tl = new TimeLog(); foreach ($staffs as $staff) { $time_log = $tl->getLastByStaffId($staff['id']); if ($time_log) { $time_logs[] = $time_log; } } $this->time_logs = $time_logs; }