本文整理汇总了PHP中ezpObject::fetchDataMap方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpObject::fetchDataMap方法的具体用法?PHP ezpObject::fetchDataMap怎么用?PHP ezpObject::fetchDataMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezpObject
的用法示例。
在下文中一共展示了ezpObject::fetchDataMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testURLAliasSplitParentTranslation
/**
* Tests a problem which arose when a combined URL entry,
* representing several translations are split up, by one translation being
* changed to to an earlier history entry, of that same entry.
*
* Note: __FUNCTION__ will be appended to every name/title attribute in order
* to ensure they will be unique to this test
*/
function testURLAliasSplitParentTranslation()
{
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB', 'nor-NO'));
eZContentLanguage::clearPrioritizedLanguages();
$db = eZDB::instance();
// STEP 1: Add test folder
$folder = new ezpObject("folder", 2);
$folder->name = __FUNCTION__;
$folder->publish();
// STEP 2: Add child below folder
$child = new ezpObject("folder", $folder->mainNode->node_id);
$child->name = "Child" . __FUNCTION__;
$child->publish();
// Sub-sub children disabled for now, might be used in future, for
// further assertions.
// // STEP 2a: Add a sub-sub child
// $subChild1 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild1->title = "SubChild";
// $subChild1->publish();
//
// // STEP 2b: Add a sub-sub child
// $subChild2 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild2->title = "SubChildOther";
// $subChild2->publish();
//
// // STEP 2ba: Adding sub-sub child translation
// $norSubChild2Trans = array( "title" => "SubChildOtherNor" );
// $subChild2->addTranslation( "nor-NO", $norSubChild2Trans );
//
// // STEP 2c: Add a sub-sub child
// $subChild3 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild3->title = "SubChildThird";
// $subChild3->publish();
//
// // STEP 2ca: Addubg sub-sub child translation
// $norSubChild3Trans = array( "title" => "SubChildThird" );
// $subChild3->addTranslation( "nor-NO", $norSubChild3Trans );
// STEP 3: Add translation to child with the same name
$translationAttributes = array("name" => "Child" . __FUNCTION__);
$child->addTranslation("nor-NO", $translationAttributes);
// STEP 4: Update the translation
$child->refresh();
$newVersion = $child->createNewVersion(false, true, 'nor-NO');
$norDataMap = $child->fetchDataMap($newVersion->attribute('version'), "nor-NO");
$norDataMap['name']->setAttribute('data_text', 'NorChildChanged' . __FUNCTION__);
$norDataMap['name']->store();
ezpObject::publishContentObject($child->object, $newVersion);
// STEP 5:
$child->refresh();
$child->name = "Renamed child" . __FUNCTION__;
$child->publish();
// STEP 6:
$child->refresh();
$child->name = "Child changed" . __FUNCTION__;
$child->publish();
// STEP 7:
$child->refresh();
$newVersion = $child->createNewVersion(false, true, 'nor-NO');
$norDataMap = $child->fetchDataMap($newVersion->attribute('version'), "nor-NO");
$norDataMap['name']->setAttribute('data_text', 'NorChildChanged again' . __FUNCTION__);
$norDataMap['name']->store();
ezpObject::publishContentObject($child->object, $newVersion);
// STEP 8:
$child->refresh();
$newVersion = $child->createNewVersion(false, true, 'nor-NO');
$norDataMap = $child->fetchDataMap($newVersion->attribute('version'), "nor-NO");
$norDataMap['name']->setAttribute('data_text', 'Child changed' . __FUNCTION__);
$norDataMap['name']->store();
ezpObject::publishContentObject($child->object, $newVersion);
// STEP 9:
$child->refresh();
$newVersion = $child->createNewVersion(false, true, 'nor-NO');
$norDataMap = $child->fetchDataMap($newVersion->attribute('version'), "nor-NO");
$norDataMap['name']->setAttribute('data_text', 'NorChildChanged again' . __FUNCTION__);
$norDataMap['name']->store();
ezpObject::publishContentObject($child->object, $newVersion);
$query = self::buildSql(array($child->mainNode->node_id));
$result = $db->arrayQuery($query);
$initialTranslationChild = self::urlEntryForName("Child-changed" . __FUNCTION__, $result);
$translationChild = self::urlEntryForName('NorChildChanged-again' . __FUNCTION__, $result);
self::assertEquals((int) $initialTranslationChild['id'], (int) $translationChild['id'], "Current translations of the same node need to have the same id.");
ezpINIHelper::restoreINISettings();
}