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