You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/definitions/expression-language.md
+29-28
Original file line number
Diff line number
Diff line change
@@ -5,38 +5,39 @@ All definition config entries can use expression language but it must be explici
5
5
6
6
**Functions description:**
7
7
8
-
Expression | Description | Usage | Alias
9
-
---------- | ----------- | ----- | -----
10
-
object **service**(string $id) | Get a service from the container | @=service('my_service').customMethod() | serv
11
-
mixed **parameter**(string $name) | Get parameter from the container | @=parameter('kernel.debug') | param
12
-
boolean **isTypeOf**(string $className) | Verified if `value` is instance of className | @=isTypeOf('AppBundle\\User\\User') |
13
-
mixed **resolver**(string $alias, array $args = []) | call the method on the tagged service "overblog_graphql.resolver" with args | @=resolver('blog_by_id', [value['blogID']] | res
14
-
mixed **mutation**(string $alias, array $args = []) | call the method on the tagged service "overblog_graphql.mutation" with args | @=mutation('remove_post_from_community', [value]) | mut
boolean **hasRole**(string $role) | Checks whether the token has a certain role. | @=hasRole('ROLE_API') |
19
-
boolean **hasAnyRole**(string $role1, string $role2, ...string $roleN) | Checks whether the token has any of the given roles. | @=hasAnyRole('ROLE_API', 'ROLE_ADMIN') |
20
-
boolean **isAnonymous**() | Checks whether the token is anonymous. | @=isAnonymous() |
21
-
boolean **isRememberMe**() | Checks whether the token is remember me. | @=isRememberMe() |
22
-
boolean **isFullyAuthenticated**() | Checks whether the token is fully authenticated. | @=isFullyAuthenticated() |
23
-
boolean **isAuthenticated**() | Checks whether the token is not anonymous. | @=isAuthenticated() |
24
-
boolean **hasPermission**(mixed $var, string $permission) | Checks whether the token has the given permission for the given object (requires the ACL system). | @=hasPermission(object, 'OWNER') |
25
-
boolean **hasAnyPermission**(mixed $var, array $permissions) | Checks whether the token has any of the given permissions for the given object | @=hasAnyPermission(object, ['OWNER', 'ADMIN']) |
26
-
User **getUser**() | Returns the user which is currently in the security token storage. User can be null. | @=getUser() |
| object **service**(string $id) | Get a service from the container | @=service('my_service').customMethod() | serv |
11
+
| mixed **parameter**(string $name) | Get parameter from the container | @=parameter('kernel.debug') | param |
12
+
| boolean **isTypeOf**(string $className) | Verified if `value` is instance of className | @=isTypeOf('AppBundle\\User\\User') |
13
+
| mixed **resolver**(string $alias, array $args = []) | call the method on the tagged service "overblog_graphql.resolver" with args | @=resolver('blog_by_id', [value['blogID']]| res |
14
+
| mixed **value_resolver**(array $args = [], string $method = null) | call a method on the value itself. If no method name is provided, default to resolving fieldname (info->fieldName) | @=value_resolver([args["gender"]], "getFriends") |
15
+
| mixed **mutation**(string $alias, array $args = []) | call the method on the tagged service "overblog_graphql.mutation" with args | @=mutation('remove_post_from_community', [value]) | mut |
| boolean **hasRole**(string $role) | Checks whether the token has a certain role. | @=hasRole('ROLE_API') |
20
+
| boolean **hasAnyRole**(string $role1, string $role2, ...string $roleN) | Checks whether the token has any of the given roles. | @=hasAnyRole('ROLE_API', 'ROLE_ADMIN') |
21
+
| boolean **isAnonymous**() | Checks whether the token is anonymous. | @=isAnonymous() |
22
+
| boolean **isRememberMe**() | Checks whether the token is remember me. | @=isRememberMe() |
23
+
| boolean **isFullyAuthenticated**() | Checks whether the token is fully authenticated. | @=isFullyAuthenticated() |
24
+
| boolean **isAuthenticated**() | Checks whether the token is not anonymous. | @=isAuthenticated() |
25
+
| boolean **hasPermission**(mixed $var, string $permission) | Checks whether the token has the given permission for the given object (requires the ACL system). | @=hasPermission(object, 'OWNER') |
26
+
| boolean **hasAnyPermission**(mixed $var, array $permissions) | Checks whether the token has any of the given permissions for the given object | @=hasAnyPermission(object, ['OWNER', 'ADMIN']) |
27
+
| User **getUser**() | Returns the user which is currently in the security token storage. User can be null. | @=getUser() |
27
28
28
29
29
30
**Variables description:**
30
31
31
-
Expression | Description | Scope
32
-
---------- | ----------- | --------
33
-
**typeResolver** | the type resolver | global
34
-
**object** | Refers to the value of the field for which access is being requested. For array `object` will be each item of the array. For Relay connection `object` will be the node of each connection edges. | only available for `config.fields.*.access` with query operation or mutation payload type.
35
-
**value** | Resolver value | only available in resolve context
36
-
**args** | Resolver args array | only available in resolve context
37
-
**info** | Resolver GraphQL\Type\Definition\ResolveInfo Object | only available in resolve context
38
-
**context** | context is defined by your application on the top level of query execution (useful for storing current user, environment details, etc) | only available in resolve context
39
-
**childrenComplexity** | Selection field children complexity | only available in complexity context
|**object**| Refers to the value of the field for which access is being requested. For array `object` will be each item of the array. For Relay connection `object` will be the node of each connection edges. | only available for `config.fields.*.access` with query operation or mutation payload type.|
36
+
|**value**| Resolver value | only available in resolve context |
37
+
|**args**| Resolver args array | only available in resolve context |
38
+
|**info**| Resolver GraphQL\Type\Definition\ResolveInfo Object | only available in resolve context|
39
+
|**context**| context is defined by your application on the top level of query execution (useful for storing current user, environment details, etc) | only available in resolve context|
40
+
|**childrenComplexity**| Selection field children complexity | only available in complexity context|
40
41
41
42
[For more details on expression syntax](http://symfony.com/doc/current/components/expression_language/syntax.html)
Note: At the moment, doctrine annotations on constants are not supported. So if you need to add config like description or deprecationReason, you must add @GQL\EnumValue with the constant name as name attribute on the annotation.
Note: If the attribute `name` is not set on the `@GQL\Input`, the final name will be the class name suffixed by "Input" if it doesn't have already the suffix. (ex: If the class name is `Hero` the input name will be `HeroInput`).
23
+
With Input type, the `@Field` annotation on methods are ignored, so is the annotations on properties that need a resolver.
0 commit comments