/**
  * Create a corresponding system cronk record if
  * catgory was defined by xml
  */
 private function createSystemDummyCategory()
 {
     $category = new CronkCategory();
     $category->cc_system = true;
     $category->cc_uid = $this->category['catid'];
     $category->cc_name = $this->category['title'];
     $category->cc_visible = true;
     $category->save();
     return $category;
 }
 /**
  * Create of update a category
  * @param array $cat
  * @return Ambigous <NULL, CronkCategory>
  */
 public function createCategory(array $cat)
 {
     AppKitArrayUtil::swapKeys($cat, self::$cat_map, true);
     $category = null;
     if ($this->agaviUser->hasCredential('icinga.cronk.category.admin') && isset($cat['cc_uid'])) {
         $category = AppKitDoctrineUtil::createQuery()->from('CronkCategory cc')->andWhere('cc.cc_uid=?', $cat['cc_uid'])->execute()->getFirst();
     }
     if (!$category instanceof CronkCategory || !$category->cc_id > 0) {
         $category = new CronkCategory();
     }
     $category->fromArray($cat);
     $category->save();
     return $category;
 }