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