public static function update($values, $user)
 {
     $maduleThemeGroup = new MaduleThemeGroup();
     $maduleThemeGroup->setMaduleId($values['module_id']);
     $maduleThemeGroup->setThemeGroupId($values['theme_group_id']);
     $maduleThemeGroup->save();
     return $maduleThemeGroup;
 }
예제 #2
0
 public function addThemeGroup($name)
 {
     $name = trim($name);
     $q = new Doctrine_Query();
     $maduleThemeGroup = $q->select('mt.*')->from('MaduleThemeGroup mt, mt.ThemeGroup t')->addWhere('mt.madule_id = ? and t.name = ?', array($this->getId(), $name))->fetchOne();
     if (!$maduleThemeGroup) {
         $q = new Doctrine_Query();
         $themeGroup = $q->select('t.*')->from('ThemeGroup t')->addWhere('t.name = ?', array($name))->fetchOne();
         if (!$themeGroup) {
             $themeGroup = new ThemeGroup();
             $themeGroup->setName($name);
             $themeGroup->save();
         }
         $maduleThemeGroup = new MaduleThemeGroup();
         $maduleThemeGroup->setThemeGroupId($themeGroup->getId());
         $maduleThemeGroup->setMaduleId($this->getId());
         $maduleThemeGroup->save();
     }
     return $maduleThemeGroup;
 }