本文整理汇总了PHP中ezpObject::addNode方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpObject::addNode方法的具体用法?PHP ezpObject::addNode怎么用?PHP ezpObject::addNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezpObject
的用法示例。
在下文中一共展示了ezpObject::addNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
$this->findINI = eZINI::instance('ezfind.ini');
$this->findINI->loadCache(true);
$this->solrSearch = new eZSolr();
$this->object = new ezpObject('folder', 2);
$this->object->name = 'foo';
$this->object->publish();
$this->object->addNode(43);
// Add a location under Media node
$this->solrSearch->addObject($this->object->object);
}
示例2: testIssue016395
/**
* Test mainNode()
*
* create object like this structure:
*
* rootnode(folder) - objectNode1(folder) - obj(article, language: default and nor-NO)
* \ objectNode2(folder) /
*/
public function testIssue016395()
{
//create two nodes with one object
$parentNode = new ezpObject('folder', 2);
$parentNode->publish();
$objectNode1 = new ezpObject('folder', $parentNode->mainNode->node_id);
$objectNode1->publish();
$objectNode2 = new ezpObject('folder', $parentNode->mainNode->node_id);
$objectNode2->publish();
$obj = new ezpObject('article', $objectNode1->mainNode->node_id);
$obj->title = 'English article';
$obj->body = 'This an English article';
$obj->publish();
$obj->addNode($objectNode2->mainNode->node_id);
//create a translation
$languageData = array();
$languageData['title'] = 'Norsk artikkel';
$languageData['body'] = 'Dette er en norsk artikkel.';
$obj->addTranslation('nor-NO', $languageData);
//assert the main language and translation language
$objectMainNode = $obj->object->mainNode();
$this->assertEquals('English article', $objectMainNode->getName());
$this->assertEquals('Norsk artikkel', $objectMainNode->getName('nor-NO'));
$tempLanguage = $objectMainNode->currentLanguage();
$objectMainNode->setCurrentLanguage('nor-NO');
$this->assertEquals('Norsk artikkel', $objectMainNode->attribute('name'));
$objectMainNode->setCurrentLanguage($tempLanguage);
}
示例3: testRemoveAssignments
/**
* Test to verify that eznode_assignment entres get removed.
*
* @link http://issues.ez.no/15478
*/
public function testRemoveAssignments()
{
$db = eZDB::instance();
$testSet = array();
$folder = new ezpObject( "folder", 2 );
$folder->name = __FUNCTION__;
$folder->publish();
$testSet[] = $folder;
$childOne = new ezpObject( "folder", $folder->mainNode->node_id );
$childOne->name = "ChildOne";
$childOne->publish();
$testSet[] = $childOne;
$childTwo = new ezpObject( "folder", $folder->mainNode->node_id );
$childTwo->name = "ChildTwo";
$childTwo->publish();
$testSet[] = $childTwo;
$subChildOne = new ezpObject( 'article', $childOne->mainNode->node_id );
$subChildOne->title = "SubChild";
$subChildOne->publish();
$testSet[] = $subChildOne;
$subChildTwo = new ezpObject( 'article', $childOne->mainNode->node_id );
$subChildTwo->title = "SubChildOther";
$subChildTwo->publish();
$testSet[] = $subChildTwo;
$subChildThree = new ezpObject( 'article', $childOne->mainNode->node_id );
$subChildThree->title = "SubChildThird";
$subChildThree->publish();
$testSet[] = $subChildThree;
// Let's add another placement here
$newPlacementSubChildOne = $subChildOne->addNode( $childTwo->mainNode->node_id );
$testSet[] = $newPlacementSubChildOne;
// $this->debugBasicNodeInfo( $testSet );
$coId = $newPlacementSubChildOne->attribute( 'contentobject_id' );
eZContentOperationCollection::removeAssignment( $childTwo->mainNode->node_id, $childTwo->id, array( $newPlacementSubChildOne ), false );
$checkSql = "SELECT * FROM eznode_assignment WHERE contentobject_id = {$coId}";
$result = $db->arrayQuery( $checkSql );
// After removing one of the assignments, the number of node
// assignments for the content object should be only one.
$numberOfAssignments = count( $result );
self::assertEquals( 1, $numberOfAssignments, "The number of node assignments are not correct, eznode_assignment table not cleaned up correctly." );
}
示例4: testNodeRemovalMultipleLocationsWithTranslations
/**
* Test that url data for translations in all node locations are removed,
* when a translations is removed.
*/
public function testNodeRemovalMultipleLocationsWithTranslations()
{
$folder1 = new ezpObject("folder", 2);
$folder1->name = __FUNCTION__;
$folder1->publish();
$child = new ezpObject("article", $folder1->mainNode->node_id);
$child->title = "Tester";
$child->publish();
$languageCode = "nor-NO";
$trData = array("title" => "NorTester");
$child->addTranslation($languageCode, $trData);
$folder2 = new ezpObject("folder", 2);
$folder2->name = __FUNCTION__ . "-Other";
$folder2->publish();
$newPlacement = $child->addNode($folder2->mainNode->node_id);
$child->removeTranslation($languageCode);
// Verify that all norwegian url entries are also removed
$language = eZContentLanguage::fetchByLocale($languageCode, false);
$languageId = (int) $language->attribute('id');
$fetchNorUrlEntriesSql = self::buildSql(array($child->mainNode->node_id, $newPlacement->attribute('node_id')), $languageId);
$db = eZDB::instance();
$norUrlEntries = $db->arrayQuery($fetchNorUrlEntriesSql);
self::assertEquals(0, count($norUrlEntries), "There should be no nor-NO url entries left");
}