本文整理汇总了PHP中Relationship::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::setId方法的具体用法?PHP Relationship::setId怎么用?PHP Relationship::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::setId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCommitBatch_AddToIndex_RelationshipExists_Success_ReturnsTrue
public function testCommitBatch_AddToIndex_RelationshipExists_Success_ReturnsTrue()
{
$rel = new Relationship($this->client);
$rel->setId(123);
$index = new Index($this->client, Index::TypeRelationship, 'indexname');
$request = array(array('id' => 0, 'method' => 'POST', 'to' => '/index/relationship/indexname', 'body' => array('key' => 'somekey', 'value' => 'somevalue', 'uri' => $this->endpoint . '/relationship/123')));
$return = array('code' => 200, 'data' => array(array('id' => 0)));
$this->batch->addToIndex($index, $rel, 'somekey', 'somevalue');
$this->setupTransportExpectation($request, $this->returnValue($return));
$result = $this->client->commitBatch($this->batch);
$this->assertTrue($result);
}
示例2: testDelete_PropertyContainerEntities_ReturnsIntegerOperationIndex
public function testDelete_PropertyContainerEntities_ReturnsIntegerOperationIndex()
{
$nodeA = new Node($this->client);
$nodeA->setId(123);
$nodeB = new Node($this->client);
$nodeB->setId(456);
$nodeC = new Node($this->client);
$rel = new Relationship($this->client);
$rel->setId(987)->setStartNode($nodeA)->setEndNode($nodeB);
$this->assertEquals(0, $this->batch->delete($nodeA));
$this->assertEquals(1, $this->batch->delete($nodeB));
$this->assertEquals(2, $this->batch->delete($nodeC));
$this->assertEquals(3, $this->batch->delete($rel));
}
示例3: testRemoveFromIndex_NodeTypeMismatch_ThrowsException
public function testRemoveFromIndex_NodeTypeMismatch_ThrowsException()
{
$index = new Index($this->client, Index::TypeNode, 'indexname');
$rel = new Relationship($this->client);
$rel->setId(123);
$this->setExpectedException('\\Sgpatil\\Orientphp\\Exception');
$this->client->removeFromIndex($index, $rel);
}
示例4: testDeleteRelationship_TransportError_ThrowsException
public function testDeleteRelationship_TransportError_ThrowsException()
{
$rel = new Relationship($this->client);
$rel->setId(123);
$this->transport->expects($this->once())->method('delete')->with('/relationship/123')->will($this->returnValue(array('code' => 400)));
$this->setExpectedException('Everyman\\Neo4j\\Exception');
$this->client->deleteRelationship($rel);
}
示例5: testDeleteRelationship_Failure_RelationshipRemainsInCache
public function testDeleteRelationship_Failure_RelationshipRemainsInCache()
{
$relId = 123;
$rel = new Relationship($this->client);
$rel->setId($relId);
$this->transport->expects($this->once())->method('delete')->with('/relationship/' . $relId)->will($this->returnValue(array('code' => 400)));
$this->cache->set("relationship-{$relId}", $rel);
try {
$this->client->deleteRelationship($rel);
$this->fail();
} catch (Exception $e) {
$this->assertSame($rel, $this->cache->get("relationship-{$relId}"));
}
}
示例6: testImplicitBatch_StartBatch_CloseBatch_ExpectedBatchRequest
public function testImplicitBatch_StartBatch_CloseBatch_ExpectedBatchRequest()
{
$startNode = new Node($this->client);
$endNode = new Node($this->client);
$endNode->setId(456)->useLazyLoad(false);
$rel = new Relationship($this->client);
$rel->setType('TEST')->setStartNode($startNode)->setEndNode($endNode);
$deleteNode = new Node($this->client);
$deleteNode->setId(987);
$deleteRel = new Relationship($this->client);
$deleteRel->setId(321);
$addIndexNode = new Node($this->client);
$addIndexNode->setId(654);
$removeIndexNode = new Node($this->client);
$removeIndexNode->setId(209);
$index = new Index($this->client, Index::TypeNode, 'indexname');
$request = array(array('id' => 0, 'method' => 'POST', 'to' => '/node', 'body' => null), array('id' => 1, 'method' => 'PUT', 'to' => '/node/456/properties', 'body' => array()), array('id' => 2, 'method' => 'POST', 'to' => '{0}/relationships', 'body' => array('to' => $this->endpoint . '/node/456', 'type' => 'TEST')), array('id' => 3, 'method' => 'DELETE', 'to' => '/node/987'), array('id' => 4, 'method' => 'DELETE', 'to' => '/relationship/321'), array('id' => 5, 'method' => 'POST', 'to' => '/index/node/indexname', 'body' => array('key' => 'addkey', 'value' => 'addvalue', 'uri' => $this->endpoint . '/node/654')), array('id' => 6, 'method' => 'DELETE', 'to' => '/index/node/indexname/removekey/removevalue/209'));
$return = array('code' => 200, 'data' => array(array('id' => 0, 'location' => 'http://foo:1234/db/data/node/123'), array('id' => 1), array('id' => 2, 'location' => 'http://foo:1234/db/data/relationship/789'), array('id' => 3), array('id' => 4), array('id' => 5), array('id' => 6)));
$this->setupTransportExpectation($request, $this->returnValue($return));
$batch = $this->client->startBatch();
$this->assertInstanceOf('Sgpatil\\Orientphp\\Batch', $batch);
$startNode->save();
$endNode->save();
$rel->save();
$deleteNode->delete();
$deleteRel->delete();
$index->add($addIndexNode, 'addkey', 'addvalue');
$index->remove($removeIndexNode, 'removekey', 'removevalue');
$this->assertTrue($this->client->commitBatch());
$this->assertEquals(789, $rel->getId());
$this->assertEquals(123, $startNode->getId());
}
示例7: testDump_PathsGiven_FileDescriptor_ReturnsDescriptor
public function testDump_PathsGiven_FileDescriptor_ReturnsDescriptor()
{
$nodeA = new Node($this->client);
$nodeA->setId(123)->setProperties(array('foo' => 'bar', 'baz' => 'qux'));
$nodeB = new Node($this->client);
$nodeB->setId(456)->setProperties(array('somekey' => 'somevalue'));
$relA = new Relationship($this->client);
$relA->setId(987)->setType('TEST')->setStartNode($nodeA)->setEndNode($nodeB)->setProperties(array('anotherkey' => 'anothervalue'));
$path = new Path();
$path->appendNode($nodeA);
$path->appendNode($nodeB);
$path->appendRelationship($relA);
$expected = <<<GEOFF
(123)\t{"foo":"bar","baz":"qux"}
(456)\t{"somekey":"somevalue"}
(123)-[987:TEST]->(456)\t{"anotherkey":"anothervalue"}
GEOFF;
$handle = fopen('data:text/plain,', 'w+');
$resultHandle = $this->geoff->dump($path, $handle);
self::assertSame($handle, $resultHandle);
self::assertEquals($expected, stream_get_contents($resultHandle, -1, 0));
}