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


PHP Collection::setType方法代码示例

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


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

示例1: catch

    // do nothing
}
/* drop edge if it exists */
try {
    $edge = $collections->get("edges");
    $collections->drop($edge);
} catch (Exception $e) {
    // do nothing
}
$vertex = new Collection();
$vertex->setName("vertices");
$collections->add($vertex);
$vertex = $vertex->getId();
$edge = new Collection();
$edge->setName("edges");
$edge->setType(3);
$collections->add($edge);
$edge = $edge->getId();
print "Reading graph file...\n";
$graphfilename = $argv[1];
$actionsfilename = $argv[2];
$fp = fopen($graphfilename, "rb");
if (0x1234abcd != get_next_int64($fp)) {
    print "Endianness check failed.  Endianness swap not implemented.";
    exit;
}
$nv = get_next_int64($fp);
$ne = get_next_int64($fp);
$off = get_int64_array($fp, $nv + 1);
$ind = get_int64_array($fp, $ne);
$wgt = get_int64_array($fp, $ne);
开发者ID:Auguraculums,项目名称:graphdb-testing,代码行数:31,代码来源:test.php

示例2: testCreateAndDeleteEdgeCollection

 /**
  * Try to create and delete an edge collection
  */
 public function testCreateAndDeleteEdgeCollection()
 {
     $connection = $this->connection;
     $collection = new Collection();
     $collectionHandler = new CollectionHandler($connection);
     $name = 'ArangoDB_PHP_TestSuite_TestCollection_02';
     try {
         $collectionHandler->drop($name);
     } catch (Exception $e) {
         //Silence the exception
     }
     $collection->setName($name);
     $collection->setType(3);
     $collectionHandler->add($collection);
     $resultingCollection = $collectionHandler->get($name);
     $resultingAttribute = $resultingCollection->getName();
     $this->assertTrue($name === $resultingAttribute, 'The created collection name and resulting collection name do not match!');
     $this->assertEquals(Collection::TYPE_EDGE, $resultingCollection->getType());
     $collectionHandler->delete($collection);
 }
开发者ID:TomSearch,项目名称:arangodb-php-docs,代码行数:23,代码来源:CollectionBasicTest.php

示例3: testExportEdgeObjects

 /**
  * Test export as Edge object
  */
 public function testExportEdgeObjects()
 {
     if (!$this->hasExportApi) {
         return;
     }
     try {
         $this->collectionHandler->drop('ArangoDB_PHP_TestSuite_TestEdge');
     } catch (\Exception $e) {
     }
     $edgeCollection = new Collection();
     $edgeCollection->setName('ArangoDB_PHP_TestSuite_TestEdge');
     $edgeCollection->setType(Collection::TYPE_EDGE);
     $this->collectionHandler->add($edgeCollection);
     $edgeHandler = new EdgeHandler($this->connection);
     $vertexCollection = $this->collection->getName();
     for ($i = 0; $i < 100; ++$i) {
         $edgeHandler->saveEdge($edgeCollection, $vertexCollection . "/1", $vertexCollection . "/2", array("value" => $i));
     }
     $export = new Export($this->connection, $edgeCollection, array("_flat" => false));
     $cursor = $export->execute();
     $this->assertEquals(1, $cursor->getFetches());
     $this->assertNull($cursor->getId());
     $this->assertEquals(100, $cursor->getCount());
     $this->assertEquals(1, $cursor->getFetches());
     $all = $cursor->getNextBatch();
     $this->assertEquals(100, count($all));
     foreach ($all as $doc) {
         $this->assertTrue($doc instanceof Document);
         $this->assertTrue($doc instanceof Edge);
     }
     $this->assertFalse($cursor->getNextBatch());
     $this->collectionHandler->drop('ArangoDB_PHP_TestSuite_TestEdge');
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:36,代码来源:ExportTest.php

示例4: Collection

 // set up two document collections
 $collection = new Collection("employees");
 try {
     $collectionHandler->add($collection);
 } catch (\Exception $e) {
     // collection may already exist - ignore this error for now
 }
 $collection = new Collection("departments");
 try {
     $collectionHandler->add($collection);
 } catch (\Exception $e) {
     // collection may already exist - ignore this error for now
 }
 // set up an edge collection to link the two previous collections
 $collection = new Collection("worksFor");
 $collection->setType(3);
 try {
     $collectionHandler->add($collection);
 } catch (\Exception $e) {
     // collection may already exist - ignore this error for now
 }
 // create a new department
 $marketing = Document::createFromArray(array("name" => "Marketing"));
 $documentHandler->save("departments", $marketing);
 // create another department
 $finance = Document::createFromArray(array("name" => "Finance"));
 $documentHandler->save("departments", $finance);
 // create a new employee
 $john = Document::createFromArray(array("name" => "John"));
 $documentHandler->save("employees", $john);
 // create another employee
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:31,代码来源:edge.php


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