https://github.com/rdey/graphql-federation-bundle
https://github.com/rdey/graphql-federation-bundle
bundle php74 php80 php81 sf63
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rdey/graphql-federation-bundle
- Owner: rdey
- Created: 2022-12-06T12:02:01.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-13T10:53:02.000Z (about 1 year ago)
- Last Synced: 2025-04-11T15:09:58.109Z (10 months ago)
- Topics: bundle, php74, php80, php81, sf63
- Language: PHP
- Size: 19.5 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rdey-graphql-federation-bundle
A tiny, simplistic and fragile bundle to integrate overblog/graphql-bundle
(specifically 0.13 and 0.14) and skillshare/apollo-federation-php (1.7.0).
This bundle shouldn't have to exist, as this should more properly belong
in overblog/graphql-bundle, but here we are.
## Usage
### Configuring types
You need to manually define your federated types as Symfony services.
These services need to be tagged with `overblog_graphql.type`. Our
suggestion is this:
```yaml
App\GraphQL\Type\:
resource: '../src/GraphQL/Type'
tags:
- { name: 'overblog_graphql.type' }
```
Your type class can look a little something like this (see the docs for
skillshare/apollo-federation-php for more info):
```php
'TestEntity',
'keyFields' => ['id', 'email'],
'fields' => [
'id' => [
'type' => Type::int(),
],
'email' => [
'type' => Type::string(),
],
'foobar' => [
'type' => Type::string(),
]
]
]);
}
public static function getAliases(): array
{
return ['TestEntity'];
}
}
```
### Entity type resolution
The use case is analogous to TypeResolvers in OverblogGraphQLBundle. Implement `Redeye\GraphqlFederationBundle\EntityTypeResolver\EntityTypeResolverInterface` in a service, and tag it with `redeye_graphql_federation.entity_type_resolver`.
#### Example
```php