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