コード例 #1
0
ファイル: uiConf.php プロジェクト: DBezemer/server
 public function cloneToNew($new_ui_conf_obj, $new_name = null)
 {
     $cloned = new uiConf();
     $cloned->setCopiedFrom($this);
     $all_fields = uiConfPeer::getFieldNames();
     $ignore_list = array("Id", "ConfFilePath");
     // clone from current
     baseObjectUtils::fillObjectFromObject($all_fields, $this, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, $ignore_list, BasePeer::TYPE_PHPNAME);
     //		$cloned->setNew(true);
     // override with data from the $new_ui_conf_obj - the name can be chosen to override
     if ($new_ui_conf_obj) {
         baseObjectUtils::fillObjectFromObject($all_fields, $new_ui_conf_obj, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
     }
     if ($new_name) {
         $cloned->setName($new_name);
     }
     foreach (self::$validSubTypes as $subType) {
         $suffix = $this->getSuffixBySubType($subType);
         $content = $this->getConfFileBySuffix($suffix);
         $cloned->setConfFileBySuffix($suffix, $content);
     }
     $cloned->save(null, true);
     return $cloned;
 }