Exemplo n.º 1
0
 public function executeDelete()
 {
     $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
     if ($group != 'root') {
         $this->forward('default', 'index');
     }
     $params = ParamsPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($params);
     $ref_error = 0;
     foreach ($params->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $params->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('params/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('params/delete', '_ERR_DELETE_ (' . $params->toString() . ' - id:' . $params->getId() . ')');
     } else {
         $params->delete();
     }
     return $this->forward('params', 'list');
 }