public function save(PropelPDO $con = null, $isClone = false) { try { $res = parent::save($con); } catch (PropelException $e) { /** * Because many ui-conf objects have hard-coded id, the auto-incremented id of new ui-conf could exist in the db. * Just retry to save the ui-conf with a different auto-inceremented id. */ if ($e->getCause() && $e->getCause()->getCode() == self::MYSQL_CODE_DUPLICATE_KEY) { $res = parent::save($con); } else { throw $e; // Rethrow the unfamiliar exception } } if ($this->shouldSetContent()) { foreach ($this->content as $contentItem) { $confFile = $this->getConfFileBySuffix($contentItem['suffix']); if ($confFile) { $this->saveConfFileToDisk($confFile, $contentItem['suffix'], $isClone); } $contentItem['shouldSet'] = false; } $res = parent::save($con); } $this->getConfFilePath(); return $res; }
public function save(PropelPDO $con = null, $isClone = false) { $this->validateConfFilesExistance(); $res = parent::save($con); if ($this->should_call_set_data_content2 || $this->should_call_set_data_content) { $confFile = $this->getConfFile(); $confFile2 = $this->getConfFile2(); if ($isClone) { $this->setVersion(1); } else { $version = $this->getVersion(); if (!is_numeric($version)) { $this->setVersion(1); } else { $this->setVersion($version + 1); } } if ($confFile) { $this->saveConfFileToDisk($confFile, null, $isClone); } // save uiConf.xml if ($confFile2) { $this->saveConfFileToDisk($confFile2, self::FILE_NAME_FEATURES, $isClone); } // save uiConf.xml.features $this->should_call_set_data_content = false; // clear dirty flag $this->should_call_set_data_content2 = false; // clear dirty flag $res = parent::save($con); } $this->getConfFilePath(); return $res; }