mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +03:00
Reverted one minor breaking change
This commit is contained in:
parent
a612b780c9
commit
276a58f6d1
40
UPGRADE.md
40
UPGRADE.md
@ -39,46 +39,6 @@ GraphQL\Schema::$queryType;
|
|||||||
So if you rely on any protected properties or methods of any GraphQL class, make sure to
|
So if you rely on any protected properties or methods of any GraphQL class, make sure to
|
||||||
delete leading underscores.
|
delete leading underscores.
|
||||||
|
|
||||||
### 3. Returning closure from field resolver
|
|
||||||
Previously when you returned closure from any resolver, expected signature of this closure
|
|
||||||
was `function($sourceValue)`, new signature is `function($args, $context)`
|
|
||||||
(now mirrors reference graphql-js implementation)
|
|
||||||
|
|
||||||
Before the change:
|
|
||||||
```php
|
|
||||||
new ObjectType([
|
|
||||||
'name' => 'Test',
|
|
||||||
'fields' => [
|
|
||||||
'a' => [
|
|
||||||
'type' => Type::string(),
|
|
||||||
'resolve' => function() {
|
|
||||||
return function($value) {
|
|
||||||
return 'something';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
])
|
|
||||||
|
|
||||||
```
|
|
||||||
After the change:
|
|
||||||
```php
|
|
||||||
new ObjectType([
|
|
||||||
'name' => 'Test',
|
|
||||||
'fields' => [
|
|
||||||
'a' => [
|
|
||||||
'type' => Type::string(),
|
|
||||||
'resolve' => function() {
|
|
||||||
return function($args, $context) {
|
|
||||||
return 'something';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
])
|
|
||||||
```
|
|
||||||
(note the closure signature change)
|
|
||||||
|
|
||||||
## Upgrade v0.6.x > v0.7.x
|
## Upgrade v0.6.x > v0.7.x
|
||||||
|
|
||||||
There are a few new breaking changes in v0.7.0 that were added to the graphql-js reference implementation
|
There are a few new breaking changes in v0.7.0 that were added to the graphql-js reference implementation
|
||||||
|
@ -675,7 +675,7 @@ class Executor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $property instanceof \Closure ? $property($args, $context) : $property;
|
return $property instanceof \Closure ? $property($source, $args, $context) : $property;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ class Adder
|
|||||||
{
|
{
|
||||||
$this->num = $num;
|
$this->num = $num;
|
||||||
|
|
||||||
$this->test = function($args, $context) {
|
$this->test = function($source, $args, $context) {
|
||||||
return $this->num + $args['addend1'] + $context['addend2'];
|
return $this->num + $args['addend1'] + $context['addend2'];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user