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


PHP ezpObject::removeTranslation方法代码示例

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


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

示例1: testSplitParentSyndrome

 /**
  * Test for URL-alias issue which could occur when a parent entry was split
  * across multiple IDs, and children with various language masks did not
  * receive the correct parent id. Such a case with a split parent id, made
  * it impossible to handle this situation correctly.
  *
  * The fix constitutes of always creating the current entries for an action
  * in the same id.
  *
  * @link http://issues.ez.no/12720
  */
 public static function testSplitParentSyndrome()
 {
     $db = eZDB::instance();
     // Ordered array containing the current name for an entry at level,
     // where level is the same as the index.
     $nameStructure = array();
     $nameStructure[] = array(__FUNCTION__);
     // STEP 1: Create Root folder
     $rootFolder = new ezpObject("folder", 2);
     $rootFolder->name = $nameStructure[0][0];
     $rootFolder->publish();
     $rootId = $rootFolder->mainNode->node_id;
     // STEP 2: Create Child article
     $nameStructure[] = array("ChildNode");
     $child = new ezpObject("article", $rootFolder->mainNode->node_id);
     $child->title = $nameStructure[1][0];
     $child->publish();
     $childId = $child->mainNode->node_id;
     $query = self::buildSql(array(2, $rootId, $childId));
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 2");
     // STEP 4: Renaming root folder
     // Updating the name structure on renames
     $nameStructure[0] = array("TestContainerA");
     $rootFolder->name = $nameStructure[0][0];
     $rootFolder->publish();
     // STEP 5: Renaming root folder
     $nameStructure[0] = array("TestContainerB");
     $rootFolder->name = $nameStructure[0][0];
     $rootFolder->publish();
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 5");
     // STEP 6: Rename root folder back to name in history.
     $nameStructure[0] = array("TestContainer");
     $rootFolder->name = $nameStructure[0][0];
     $rootFolder->publish();
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 6");
     // STEP 7: Translate root folder into norwegian.
     $nameStructure[0][] = "TestBinge";
     $trData = array("name" => $nameStructure[0][1]);
     $rootFolder->addTranslation("nor-NO", $trData);
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 7");
     // STEP 8: Translate childe article into norwegian
     $nameStructure[1][] = "BarneNode";
     $trData = array("title" => $nameStructure[1][1]);
     $child->addTranslation("nor-NO", $trData);
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 8");
     // STEP 9: We rename the Norwegian translation of the child element to the
     //         same name as the English translation
     unset($nameStructure[1][1]);
     $child->refresh();
     $newVersion = $child->createNewVersion(false, true, 'nor-NO');
     $norDataMap = $child->fetchDataMap($newVersion->attribute('version'), "nor-NO");
     $norDataMap['title']->setAttribute('data_text', $nameStructure[1][0]);
     $norDataMap['title']->store();
     ezpObject::publishContentObject($child->object, $newVersion);
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 9");
     // STEP 10: We remove Norwegian translation.
     $child->refresh();
     $child->removeTranslation("nor-NO");
     $rows = $db->arrayQuery($query);
     $result = self::verifyUrlEntryParentStructure($nameStructure, $rows);
     self::assertTrue($result, "Fail after step 10");
 }
开发者ID:,项目名称:,代码行数:85,代码来源:


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