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