当前位置: 首页>>代码示例>>PHP>>正文


PHP TranslationPeer::nameSpaceExists方法代码示例

本文整理汇总了PHP中TranslationPeer::nameSpaceExists方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationPeer::nameSpaceExists方法的具体用法?PHP TranslationPeer::nameSpaceExists怎么用?PHP TranslationPeer::nameSpaceExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TranslationPeer的用法示例。


在下文中一共展示了TranslationPeer::nameSpaceExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteRow

 public function deleteRow($aRowData, $oCriteria)
 {
     $bResult = false;
     $sNameSpace = TranslationPeer::getNameSpaceFromStringKey($aRowData['id']);
     if (TranslationPeer::doDelete($oCriteria) && $sNameSpace !== null) {
         $bResult = !TranslationPeer::nameSpaceExists($sNameSpace);
     }
     return array(StringDetailWidgetModule::SIDEBAR_CHANGED => $bResult);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:9,代码来源:StringListWidgetModule.php

示例2: saveData

 public function saveData($aStringData)
 {
     $this->validate($aStringData);
     if (!Flash::noErrors()) {
         throw new ValidationException();
     }
     $oConnection = Propel::getConnection();
     foreach (LanguageQuery::create()->orderById()->find() as $oLanguage) {
         $oUpdateCriteria = new Criteria();
         $oUpdateCriteria->add(TranslationPeer::LANGUAGE_ID, $oLanguage->getId());
         $oUpdateCriteria->add(TranslationPeer::STRING_KEY, $this->sStringId);
         if (isset($aStringData['text_' . $oLanguage->getId()])) {
             $sText = trim($aStringData['text_' . $oLanguage->getId()]);
             $oString = TranslationQuery::create()->findPk(array($oLanguage->getId(), $this->sStringId));
             if ($sText === '') {
                 if ($oString !== null) {
                     $oString->delete();
                 }
                 continue;
             }
             if ($oString === null) {
                 $oString = new Translation();
                 $oString->setLanguageId($oLanguage->getId());
                 $oString->setStringKey($aStringData['string_key']);
             } else {
                 if ($this->sStringId !== null && $this->sStringId !== $aStringData['string_key']) {
                     $oString->setStringKey($aStringData['string_key']);
                     BasePeer::doUpdate($oUpdateCriteria, $oString->buildCriteria(), $oConnection);
                 }
             }
             $oString->setText($sText);
             $oString->save();
         } else {
             $oString = TranslationQuery::create()->findPk(array($oLanguage->getId(), $this->sStringId));
             if ($oString === null) {
                 continue;
             }
             if ($this->sStringId !== null && $this->sStringId !== $aStringData['string_key']) {
                 $oString->setStringKey($aStringData['string_key']);
                 BasePeer::doUpdate($oUpdateCriteria, $oString->buildCriteria(), $oConnection);
             }
         }
     }
     // check sidebar reload criteria
     $sNameSpaceOld = TranslationPeer::getNameSpaceFromStringKey($this->sStringId);
     $sNameSpaceNew = TranslationPeer::getNameSpaceFromStringKey($aStringData['string_key']);
     // if both are the same the sidebar is not effected
     $bSidebarHasChanged = false;
     if ($sNameSpaceOld !== $sNameSpaceNew) {
         // if there was an old name space then we have to check whether it was the last string with this namespace
         if ($sNameSpaceOld !== null && !TranslationPeer::nameSpaceExists($sNameSpaceOld)) {
             $bSidebarHasChanged = true;
         }
         // if the new exits only once it has been created and the sidebar needs to be relaoded
         if ($sNameSpaceNew !== null && TranslationPeer::countNameSpaceByName($sNameSpaceNew) === 1) {
             $bSidebarHasChanged = true;
         }
     }
     $this->sStringId = $aStringData['string_key'];
     return array('id' => $this->sStringId, self::SIDEBAR_CHANGED => $bSidebarHasChanged);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:61,代码来源:StringDetailWidgetModule.php


注:本文中的TranslationPeer::nameSpaceExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。