Skip to content

Commit 800a79e

Browse files
authored
Merge 21c113f into 6534df6
2 parents 6534df6 + 21c113f commit 800a79e

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

UPGRADE-1.0.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ UPGRADE FROM 0.13 to 1.0
44
# Table of Contents
55

66
- [Customize the cursor encoder of the edges of a connection](#customize-the-cursor-encoder-of-the-edges-of-a-connection)
7-
- [Change arguments of TypeGenerator](#change-arguments-of-typegenerator)
7+
- [Change arguments of `TypeGenerator`](#change-arguments-of-typegenerator)
8+
- [Add magic `__get` method to `ArgumentInterface` and `Argument`](#add-magic-__get-method-to-argumentinterface-and-argument)
89

910
### Customize the cursor encoder of the edges of a connection
1011

@@ -34,7 +35,7 @@ $connectionBuilder = new ConnectionBuilder(
3435

3536
### Change arguments of `TypeGenerator` class
3637

37-
The `TypeGenerator` service is used internally for GraphQL types compilation. If you overridden the service definition,
38+
The `Overblog\GraphQLBundle\Generator\TypeGenerator` service is used internally for GraphQL types compilation. If you overridden the service definition,
3839
please take into account the new constructor signature:
3940

4041
```diff
@@ -51,3 +52,35 @@ public function __construct(
5152
) {
5253
```
5354
`TypeBuilder` here is a new service `Overblog\GraphQLBundle\Generator\TypeBuilder`, which is also used internally.
55+
56+
### Add magic `__get` method to `ArgumentInterface` and `Argument`
57+
58+
The interface `Overblog\GraphQLBundle\Definition\ArgumentInterface` as well as implementing it class
59+
`Overblog\GraphQLBundle\Definition\Argument` now have the magic `__get` method:
60+
61+
```diff
62+
interface ArgumentInterface extends ArrayAccess, Countable
63+
{
64+
/**
65+
* @return array the old array
66+
*/
67+
public function exchangeArray(array $array): array;
68+
69+
public function getArrayCopy(): array;
70+
71+
+ /**
72+
+ * @return mixed
73+
+ */
74+
+ public function __get(string $name);
75+
}
76+
77+
class Argument implements ArgumentInterface
78+
{
79+
// ...
80+
81+
+ public function __get(string $name)
82+
+ {
83+
+ return $this->rawArguments[$name] ?? null;
84+
+ }
85+
}
86+
```

src/Definition/Argument.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ public function count(): int
8787
{
8888
return count($this->rawArguments);
8989
}
90+
91+
public function __get(string $name)
92+
{
93+
return $this->rawArguments[$name] ?? null;
94+
}
9095
}

src/Definition/ArgumentInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ interface ArgumentInterface extends ArrayAccess, Countable
1515
public function exchangeArray(array $array): array;
1616

1717
public function getArrayCopy(): array;
18+
19+
/**
20+
* @return mixed
21+
*/
22+
public function __get(string $name);
1823
}

tests/Functional/App/config/access/mapping/access.types.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ User:
3838
resolve: ['ROLE_USER']
3939
isEnabled:
4040
# access as a promise
41-
access: "@=resolver('promise', [args['hasAccess']])"
41+
access: "@=resolver('promise', [args.hasAccess])"
4242
args:
4343
hasAccess: {type: Boolean!}
4444
type: Boolean

0 commit comments

Comments
 (0)