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