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