-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
265 additions
and
261 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Upgrade from v4 to v5 | ||
|
||
### BREAKING: Promises are based on `amphp/amp` instead of `react/promise` | ||
|
||
If you have any resolvers waiting for promises using the `->then()` method you need to replace these with the `yield` keyword. | ||
|
||
**Example:** | ||
|
||
```php | ||
public function topVotedComment(Article $source, $args, $context, $info) | ||
{ | ||
return $context['loader'](Closure::fromCallable([$this, 'loadComments'])) | ||
->load($source->id) | ||
->then(function ($articleComments) { | ||
return collect($articleComments)->sortByDesc('votes')->first(); | ||
}); | ||
} | ||
``` | ||
|
||
to | ||
|
||
```php | ||
public function topVotedComment(Article $source, $args, $context, $info) | ||
{ | ||
$comments = yield $context['loader'](Closure::fromCallable([$this, 'loadComments'])) | ||
->load($source->id); | ||
|
||
return collect($comments)->sortByDesc('votes')->first(); | ||
} | ||
``` | ||
|
||
### BREAKING: The signature of `Butler\Graphql\DataLoader@__construct` has changed | ||
|
||
If you manually instantiate `Butler\Graphql\DataLoader` anywhere you need to update your code. It's no longer necessary to provide a `React\EventLoop\LoopInterface` to the constructor. | ||
|
||
**Example:** | ||
|
||
```php | ||
$dataLoader = new DataLoader($this->getLoop()); | ||
``` | ||
|
||
to | ||
|
||
```php | ||
$dataLoader = new DataLoader(); | ||
``` |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 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
Oops, something went wrong.