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