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