We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 92d8682 commit 81bcdadCopy full SHA for 81bcdad
1 file changed
doc/producers/custom.md
@@ -136,4 +136,15 @@ we get a result like this :
136
}
137
```
138
139
-(For this to actually work we would need to add resolvers to the User object to resolve the `id` and `name` properties).
+For this to actually work we would need to add resolvers to the User object to resolve the `id` and `name` properties like so:
140
+```php
141
+ $registry->addFieldResolver('User', 'id', $builder->callback(function ($account) {
142
+ /** @var \Drupal\Core\Session\AccountProxyInterface $account */
143
+ return $account->id();
144
+ }));
145
+
146
+ $registry->addFieldResolver('User', 'name', $builder->callback(function ($account) {
147
148
+ return $account->getAccountName();
149
150
+```
0 commit comments