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