Skip to content

Commit

Permalink
Merge pull request #246 from utopia-php/feat-relationships
Browse files Browse the repository at this point in the history
Feat relationships
  • Loading branch information
abnegate authored Apr 11, 2023
2 parents 5666ad8 + 84a3aea commit f162c14
Show file tree
Hide file tree
Showing 20 changed files with 9,380 additions and 358 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"php": ">=8.0",
"utopia-php/framework": "0.*.*",
"utopia-php/cache": "0.8.*",
"utopia-php/mongo": "0.1.*"
"utopia-php/mongo": "0.2.*"
},
"require-dev": {
"ext-redis": "*",
Expand All @@ -46,7 +46,7 @@
"swoole/ide-helper": "4.8.0",
"utopia-php/cli": "^0.14.0",
"laravel/pint": "1.4.*",
"phpstan/phpstan": "1.9.*",
"phpstan/phpstan": "1.10.*",
"rregeer/phpunit-coverage-check": "^0.3.1"
},
"suggests": {
Expand Down
31 changes: 17 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
Expand Down
48 changes: 47 additions & 1 deletion src/Database/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ abstract public function deleteCollection(string $name): bool;
* @param int $size
* @param bool $signed
* @param bool $array
*
* @return bool
*/
abstract public function createAttribute(string $collection, string $id, string $type, int $size, bool $signed = true, bool $array = false): bool;
Expand Down Expand Up @@ -242,6 +241,46 @@ abstract public function deleteAttribute(string $collection, string $id): bool;
*/
abstract public function renameAttribute(string $collection, string $old, string $new): bool;

/**
* @param string $collection
* @param string $relatedCollection
* @param string $type
* @param bool $twoWay
* @param string $id
* @param string $twoWayKey
* @return bool
*/
abstract public function createRelationship(string $collection, string $relatedCollection, string $type, bool $twoWay = false, string $id = '', string $twoWayKey = ''): bool;

/**
* Update Relationship
*
* @param string $collection
* @param string $relatedCollection
* @param string $type
* @param bool $twoWay
* @param string $key
* @param string $twoWayKey
* @param string|null $newKey
* @param string|null $newTwoWayKey
* @return bool
*/
abstract public function updateRelationship(string $collection, string $relatedCollection, string $type, bool $twoWay, string $key, string $twoWayKey, ?string $newKey = null, ?string $newTwoWayKey = null): bool;

/**
* Delete Relationship
*
* @param string $collection
* @param string $relatedCollection
* @param string $type
* @param bool $twoWay
* @param string $key
* @param string $twoWayKey
* @param string $side
* @return bool
*/
abstract public function deleteRelationship(string $collection, string $relatedCollection, string $type, bool $twoWay, string $key, string $twoWayKey, string $side): bool;

/**
* Rename Index
*
Expand Down Expand Up @@ -443,6 +482,13 @@ abstract public function getSupportForQueryContains(): bool;
*/
abstract public function getSupportForTimeouts(): bool;

/**
* Are relationships supported?
*
* @return bool
*/
abstract public function getSupportForRelationships(): bool;

/**
* Get current attribute count from collection document
*
Expand Down
Loading

0 comments on commit f162c14

Please sign in to comment.