-
Notifications
You must be signed in to change notification settings - Fork 55
Feat 5376 improve the select query #287
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
Closed
faisalill
wants to merge
20
commits into
utopia-php:main
from
faisalill:feat-5376-improve-the-select-query
Closed
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0777736
fixed query and attribute types
faisalill 1ca3476
Merge pull request #3 from faisalill/work-feat-5376
faisalill fedafbf
cleaned composer.json
faisalill 0278adf
clean code
faisalill cde877c
changed few assertions for testFindSelect
faisalill b93544f
return by default
faisalill 3a3b51f
permissions can be queried now
faisalill e39efe7
added assertions to test that other default keys are not returned
faisalill 60bae57
fixed errors from testFindSelect
faisalill c4c6e2a
removed mytest from composer.json
faisalill f901305
added more assertions
faisalill e61eb13
fixed mongodb and postgres issue
faisalill 0313f8c
fixed whitespace related issue
faisalill 5fd6373
fixed lint issue
faisalill 27364ea
Merge branch 'utopia-php:main' into feat-5376-improve-the-select-query
faisalill 85afec2
Made changes as per review
faisalill 4d20bc3
Merge branch 'utopia-php:main' into feat-5376-improve-the-select-query
faisalill a2d25c4
Fix code as per review
faisalill e480ad8
Make changes as per review
faisalill 56dedb3
Merge branch 'utopia-php:main' into feat-5376-improve-the-select-query
faisalill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1016,7 +1016,9 @@ public function testGetDocument(Document $document): Document | |
| */ | ||
| public function testGetDocumentSelect(Document $document): Document | ||
| { | ||
| $document = static::getDatabase()->getDocument('documents', $document->getId(), [ | ||
| $documentId = $document->getId(); | ||
|
|
||
| $document = static::getDatabase()->getDocument('documents', $documentId, [ | ||
| Query::select(['string', 'integer']), | ||
| ]); | ||
|
|
||
|
|
@@ -1029,6 +1031,22 @@ public function testGetDocumentSelect(Document $document): Document | |
| $this->assertArrayNotHasKey('boolean', $document->getAttributes()); | ||
| $this->assertArrayNotHasKey('colors', $document->getAttributes()); | ||
| $this->assertArrayNotHasKey('with-dash', $document->getAttributes()); | ||
| $this->assertArrayNotHasKey('$id', $document); | ||
| $this->assertArrayNotHasKey('$internalId', $document); | ||
| $this->assertArrayNotHasKey('$collection', $document); | ||
| $this->assertArrayNotHasKey('$permissions', $document); | ||
| $this->assertArrayNotHasKey('$createdAt', $document); | ||
| $this->assertArrayNotHasKey('$updatedAt', $document); | ||
|
|
||
| $document = static::getDatabase()->getDocument('documents', $documentId, [ | ||
| Query::select(['string', 'integer', '$id', '$internalId', '$permissions', '$createdAt', '$updatedAt']), | ||
| ]); | ||
|
|
||
| $this->assertArrayHasKey('$id', $document); | ||
| $this->assertArrayHasKey('$internalId', $document); | ||
| $this->assertArrayHasKey('$permissions', $document); | ||
| $this->assertArrayHasKey('$createdAt', $document); | ||
| $this->assertArrayHasKey('$updatedAt', $document); | ||
|
|
||
| return $document; | ||
| } | ||
|
|
@@ -2539,18 +2557,19 @@ public function testFindSelect(): void | |
| $documents = static::getDatabase()->find('movies', [ | ||
| Query::select(['name', 'year']) | ||
| ]); | ||
|
|
||
| foreach ($documents as $document) { | ||
| $this->assertArrayHasKey('$id', $document); | ||
| $this->assertArrayHasKey('$internalId', $document); | ||
| $this->assertArrayHasKey('$collection', $document); | ||
| $this->assertArrayHasKey('$createdAt', $document); | ||
| $this->assertArrayHasKey('$updatedAt', $document); | ||
| $this->assertArrayHasKey('$permissions', $document); | ||
| $this->assertArrayHasKey('name', $document); | ||
| $this->assertArrayHasKey('year', $document); | ||
| $this->assertArrayNotHasKey('director', $document); | ||
| $this->assertArrayNotHasKey('price', $document); | ||
| $this->assertArrayNotHasKey('active', $document); | ||
| $this->assertArrayNotHasKey('director', $document); | ||
| $this->assertArrayNotHasKey('$id', $document); | ||
| $this->assertArrayNotHasKey('$internalId', $document); | ||
| $this->assertArrayNotHasKey('$collection', $document); | ||
| $this->assertArrayNotHasKey('$createdAt', $document); | ||
| $this->assertArrayNotHasKey('$updatedAt', $document); | ||
| $this->assertArrayNotHasKey('$permissions', $document); | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a test for the |
||
|
|
||
|
|
@@ -4156,7 +4175,7 @@ public function testOneToOneOneWayRelationship(): void | |
| $this->assertArrayNotHasKey('area', $person->getAttribute('library')); | ||
|
|
||
| $person = static::getDatabase()->getDocument('person', 'person1', [ | ||
| Query::select(['*', 'library.name']) | ||
| Query::select(['*', 'library.name', '$id']) | ||
| ]); | ||
|
|
||
| $this->assertEquals('Library 1', $person->getAttribute('library')->getAttribute('name')); | ||
|
faisalill marked this conversation as resolved.
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.