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