Comments (3)
Do you have gitter? Login there, I'll help you, it's all simple, you're just trying to add arguments to the Type when you have to work with Field.
from graphql.
Anyway, here's an example of field with arguments:
class LikePostField extends AbstractField
{
public function resolve($value, array $args, ResolveInfo $info)
{
return $info->getReturnType()->getOne($args['id']);
}
public function getType()
{
return new PostType();
}
public function build(FieldConfig $config)
{
$config->addArgument('id', new NonNullType(new IntType()));
}
}
from graphql.
Thank you very much. It works like a charm! Even, in my case:
public function resolve($value, array $args, ResolveInfo $info)
{
return $args['id'];
}
is enough. Awesome! 💯
from graphql.
Related Issues (20)
- thrown an error when type name already exists HOT 2
- Troubleshooting needs to mention php-mbstring HOT 1
- Possible incorrect parsing of some scalar values HOT 2
- Are you looking for help in maintaining this library? HOT 5
- counting queries in payload HOT 1
- Scoping errors to the offending query when batching queries HOT 2
- Public Static Function getPropertyValue() when var in entity starts with "is" HOT 1
- How to pass ListType as argument ? HOT 1
- Tag new version HOT 2
- Improve debugging process HOT 1
- ResolvableObjectTrait should gracefully return null for all nullable types, not just scalar ones HOT 1
- Add support for error extensions
- Update Scrutinizer CI integration after organization name change HOT 2
- Not compatible with symfony 4.4 HOT 2
- PHP Fatal error when a variable is missing from operation name and dictionary of values HOT 12
- ASTField query, not its subqueries HOT 1
- Operation type directive is overriding directives defined in ancestor fields HOT 5
- Can extract the Parser as a standalone package? HOT 2
- Parsing arrays of ENUMs doesn't work
- Errors when using with PHP 8.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.