是否可以一次创建多个批次?
例如,我有一个运行批次(批次 1)的代码。在这个批次中,我有一个名为的方法,其中有另一个批次(第 2 批次)。代码不起作用。
当我删除上部批次(批次 1)时,我创建了一个节点。也许一次只有 1 批可能?
示例代码如下:
$batch = $client->startBatch();
$widget = NULL;
try {
$widgetLabel = $client->makeLabel('Widget');
$widget = $client->makeNode();
$widget
->setProperty('base_filename', md5(uniqid('', TRUE)))
->setProperty('datetime_added', time())
->setProperty('current_version', 0)
->setProperty('shared', 0)
->setProperty('active', 1)
->save();
// add widget history
$history = Model_History::create($widget, $properties);
if ($history == NULL) {
throw new Exception('Could not create widget history!');
}
$widget->setProperty('current_version', $history->getID());
$widget->save();
$client->commitBatch($batch);
} catch (Exception $e) {
$client->endBatch();
}
批次 2 在 Model_History::create() 方法中。我没有从这段代码中得到有效的 $widget - Neo4jphp 节点。