Completed
Push — master ( eea4af...ac3565 )
by Alexandr
13:12
created

BookStoreSchema::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
/**
3
 * This file is a part of GraphQL project.
4
 *
5
 * @author Alexandr Viniychuk <[email protected]>
6
 * created: 4/23/17 10:43 PM
7
 */
8
9
namespace Examples\BookStore\Schema;
10
11
12
use Examples\BookStore\DataProvider;
13
use Examples\BookStore\Schema\Field\Book\RecentBooksField;
14
use Examples\BookStore\Schema\Type\AuthorType;
15
use Youshido\GraphQL\Config\Schema\SchemaConfig;
16
use Youshido\GraphQL\Schema\AbstractSchema;
17
use Youshido\GraphQL\Type\ListType\ListType;
18
19
class BookStoreSchema extends AbstractSchema
20
{
21
    public function build(SchemaConfig $config)
22
    {
23
        $config->getQuery()->addFields([
24
            'authors' => [
25
                'type' => new ListType(new AuthorType()),
26
                'resolve'=> function() {
27
                    return DataProvider::getAuthors();
28
                }
29
            ],
30
            new RecentBooksField()
31
        ]);
32
    }
33
34
}