Exemplo n.º 1
0
 public function addThemeGroup($name)
 {
     try {
         $name = trim($name);
         $q = new Doctrine_Query();
         $themeThemeGroup = $q->select('tg.*')->from('ThemeThemeGroup tg, tg.ThemeGroup t')->addWhere('tg.theme_id = ? and t.name = ?', array($this->getId(), $name))->fetchOne();
         if (!$themeThemeGroup) {
             $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();
             }
             $themeThemeGroup = new ThemeThemeGroup();
             $themeThemeGroup->setThemeGroupId($themeGroup->getId());
             $themeThemeGroup->setThemeId($this->getId());
             $themeThemeGroup->save();
         }
         return $themeThemeGroup;
     } catch (Exception $e) {
     }
     return null;
 }
Exemplo n.º 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;
 }
 public function addThemeGroup($name)
 {
     $name = trim($name);
     $q = new Doctrine_Query();
     $applicationThemeGroup = $q->select('mt.*')->from('ApplicationThemeGroup at, mt.ThemeGroup t')->addWhere('at.application_id = ? and t.name = ?', array($this->getId(), $name))->fetchOne();
     if (!$applicationThemeGroup) {
         $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();
         }
         $applicationThemeGroup = new ApplicationThemeGroup();
         $applicationThemeGroup->setThemeGroupId($themeGroup->getId());
         $applicationThemeGroup->setApplicationId($this->getId());
         $applicationThemeGroup->save();
     }
     return $applicationThemeGroup;
 }