diff --git a/src/QueryBuilder/LinkQuery/LinkQueryBuilder.php b/src/QueryBuilder/LinkQuery/LinkQueryBuilder.php index 9bd03b6..a59f280 100644 --- a/src/QueryBuilder/LinkQuery/LinkQueryBuilder.php +++ b/src/QueryBuilder/LinkQuery/LinkQueryBuilder.php @@ -31,25 +31,27 @@ class LinkQueryBuilder - public function LinkWhat(string $relativePath): LinkQueryBuilder - { - self::ValidateDeegraphPath(target: $relativePath); - $this->RelativePath1 = $relativePath; - return $this; - } - public function LinkTo(string $relativePath): LinkQueryBuilder + public function LinkToRelativePath(string $relativePath1, string $relativePath2): LinkQueryBuilder { + self::EnsureNotSet($this->RelativePath1); self::EnsureNotSet($this->RelativePath2); - self::ValidateDeegraphPath(target: $relativePath); - $this->RelativePath2 = $relativePath; + self::ValidateDeegraphPath(target: $relativePath1); + self::ValidateDeegraphPath(target: $relativePath2); + $this->RelativePath1 = $relativePath1; + $this->RelativePath2 = $relativePath2; + $this->ToOrOf = "TO"; return $this; } - public function LinkOf(string $relativePath): LinkQueryBuilder + public function LinkOfRelativePath(string $relativePath1, string $relativePath2): LinkQueryBuilder { + self::EnsureNotSet($this->RelativePath1); self::EnsureNotSet($this->RelativePath2); - self::ValidateDeegraphPath(target: $relativePath); - $this->RelativePath2 = $relativePath; + self::ValidateDeegraphPath(target: $relativePath1); + self::ValidateDeegraphPath(target: $relativePath2); + $this->RelativePath1 = $relativePath1; + $this->RelativePath2 = $relativePath2; + $this->ToOrOf = "OF"; return $this; } diff --git a/tests/QueryBuilderLinkTest.php b/tests/QueryBuilderLinkTest.php index a1deb9c..8b042c9 100644 --- a/tests/QueryBuilderLinkTest.php +++ b/tests/QueryBuilderLinkTest.php @@ -14,8 +14,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} TO {$this->TestUUID} AS test", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkTo($this->TestUUID) + ->LinkToRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Build() ); @@ -25,8 +24,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} TO {$this->TestUUID} AS test OVERWRITE", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkTo($this->TestUUID) + ->LinkToRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Overwrite() ->Build() @@ -37,8 +35,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} TO {$this->TestUUID} AS test REPLACE", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkTo($this->TestUUID) + ->LinkToRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Replace() ->Build() @@ -49,8 +46,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} TO {$this->TestUUID} AS test FORCE", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkTo($this->TestUUID) + ->LinkToRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Force() ->Build() @@ -61,8 +57,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} OF {$this->TestUUID} AS test", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkOf($this->TestUUID) + ->LinkOfRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Build() ); @@ -73,8 +68,7 @@ final class QueryBuilderLinkTest extends TestCase self::assertEquals( expected: "LINK {$this->TestUUID} OF {$this->TestUUID} AS test", actual: QueryBuilder::Link() - ->LinkWhat($this->TestUUID) - ->LinkOf($this->TestUUID) + ->LinkOfRelativePath($this->TestUUID, $this->TestUUID) ->As("test") ->Overwrite() ->Replace()