public function executeDelete() { $student_job_history = StudentJobHistoryPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_job_history); $student_id = $student_job_history->getStudentId(); $ref_error = 0; foreach ($student_job_history->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $student_job_history->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('student_job_history/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('student_job_history/delete', '_ERR_DELETE_ (' . $student_job_history->toString() . ' - id:' . $student_job_history->getId() . ')'); } else { $student_job_history->delete(); } return $this->redirect('student_job_history/list?student_id=' . $student_id); }