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

feat(dev) Support query predicates for graph commit command #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jblotus
Copy link

@jblotus jblotus commented Jun 29, 2021

When creating a Node you can specify a predicate via withQueryPredicate()
or optional constructor parameter. When not specified the default predicate
is MATCH.

When creating an edge, you can use the Edge::create() or
Edge::merge() methods to determine the strategy.

When creating a Node you can specify a predicate via withQueryPredicate()
or optional constructor parameter. When not specified the default predicate
is MATCH.

When creating an edge, you can use the Edge::create() or
Edge::merge() methods to determine the strategy.
$graph->addEdge($edge);
$query = $graph->getCommitQueryWithMerge();
$this->assertEquals(
'MATCH (CatOwner:person {name: "John Doe", age: 33, gender: "male", status: "single"}) ' .
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice the match match merge here

$content = ob_get_clean();
echo $content;
$expectedLines = <<<EOT
-----------------------------------------
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests were a little tricky to update but I'm glad they are here!

@@ -104,4 +113,9 @@ private function getPropValueWithDataType($propValue)
}
return (int) $propValue;
}

public function getQueryPredicate(): string
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit is important that i set it to default to MATCH to preserve existing behavior

@mkorkmaz
Copy link
Owner

I'll try to review this in a couple of days. I have ideas that can be applied after this PR.

@jblotus
Copy link
Author

jblotus commented Jun 29, 2021

No rush please - this is merely some ideas I had.

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

Successfully merging this pull request may close these issues.

None yet

2 participants