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