Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addLabels to node fails in Batch mode #94

Open
mcuadros opened this issue Oct 19, 2013 · 3 comments
Open

addLabels to node fails in Batch mode #94

mcuadros opened this issue Oct 19, 2013 · 3 comments

Comments

@mcuadros
Copy link

Hi,

I am very new with neo4j and of course with neo4jphp, so i dont know if i am missing something.

When the batch mode is on and i create a node and after i add label, then throw an exception about the node is not saved

$batch = $this->neo4->startBatch();
$label = $this->neo4j->makeLabel(self::LABEL_USER);

$partner = $this->neo4j->makeNode();
$partner
    ->setProperty('mongoId', (string) $origin->getId())
    ->setProperty('slug', $origin->getSlug())
    ->setProperty('name', $origin->getName())
    ->save();

$node->addLabels([$label]);

$batch->commit();

How i can create a node and add a label in batch mode? Is this possible?

Regards and thanks

@jquequezana
Copy link

Hello I have the same problem, someone can help or explain another way to do this.

Regards

@mcuadros
Copy link
Author

mcuadros commented Nov 3, 2013

I made a PR but i not accepted because in under way another implementation.

#95

@ghost
Copy link

ghost commented Jan 16, 2014

I think that i found some solution...
@ Everyman\Neo4j\Command\SetLabels
on __constructor

    $nodeId = $node->getId();
    if (!$nodeId) {
            throw new \InvalidArgumentException("Cannot set labels on an unsaved node");
    }

to

    $nodeId = $node->getId();
    if (!$nodeId) {
        if($nodeId != 0)
        {
            throw new \InvalidArgumentException("Cannot set labels on an unsaved node");
        }
    }

Some times the $node is equles to 0 and it comfusing between false and Node#0

@ghost ghost mentioned this issue Jan 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants