2017 © Pedro Peláez
 

library graphql-package

PAC GraqhQL package

image

pac/graphql-package

PAC GraqhQL package

  • Wednesday, November 29, 2017
  • by iampersistent
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

GraphQL package

Configuration

graphql:
    mutation:
        class: MyApp\GraphQL\Type\MutationType
        fields:
            - '@graphql.field.create_matter'
            - '@graphql.field.add_party_to_matter'
    query:
        class: MyApp\GraphQL\Type\QueryType
        fields:
            - '@graphql.field.matter'
            - '@graphql.field.matter_list'
            - '@graphql.field.ping'
    schema:
        class: MyApp\GraphQL\AppSchema

<?php
declare(strict_types=1);

namespace MyApp\GraphQL\Type;

use Pac\GraphQL\AbstractConfigurableFieldType;

class MutationType extends AbstractConfigurableFieldType
{
    public function getName()
    {
        return 'MutationType';
    }
}

```php <?php declare(strict_types=1);, (*1)

namespace MyApp\GraphQL\Type;, (*2)

use Pac\GraphQL\AbstractConfigurableFieldType;, (*3)

class QueryType extends AbstractConfigurableFieldType { public function getName() { return 'QueryType'; } }, (*4)

```php
<?php
declare(strict_types=1);

namespace MyApp\GraphQL;

use MyApp\GraphQL\Type\MutationType;
use MyApp\GraphQL\Type\QueryType;
use Youshido\GraphQL\Config\Schema\SchemaConfig;
use Youshido\GraphQL\Schema\AbstractSchema;

class AppSchema extends AbstractSchema
{
    public function __construct(QueryType $query, MutationType $mutation)
    {
        $config = [
            'query' => $query,
            'mutation' => $mutation,
            'types' => [],
        ];

        parent::__construct($config);
    }

    public function build(SchemaConfig $config)
    {
        // right now, nothing to do
    }
}

The Versions