Skip to content

Commit

Permalink
Changed namespace
Browse files Browse the repository at this point in the history
It's not a SilverStripe organisation module, at least not yet :)
  • Loading branch information
chillu committed Sep 18, 2016
1 parent ccb12c0 commit 27dad3b
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ It uses the [graphql-php](https://github.com/webonyx/graphql-php) library.
Require the [composer](http://getcomposer.org) package in your `composer.json`

```
composer require silverstripe/graphql
composer require chillu/silverstripe-graphql
```

## Usage
Expand All @@ -28,7 +28,7 @@ You need to define *Types* and *Queries* to expose your data via this endpoint.


```yml
SilverStripe\GraphQL:
Chillu\GraphQL:
schema:
types:
member: 'MyProject\GraphQL\MemberTypeCreator'
Expand All @@ -39,7 +39,7 @@ SilverStripe\GraphQL:
namespace MyProject\GraphQL;

use GraphQL\Type\Definition\Type;
use SilverStripe\GraphQL\TypeCreator;
use Chillu\GraphQL\TypeCreator;

class MemberTypeCreator extends TypeCreator {

Expand All @@ -61,7 +61,7 @@ class MemberTypeCreator extends TypeCreator {
### Define Queries

```yml
SilverStripe\GraphQL:
Chillu\GraphQL:
schema:
queries:
members: 'MyProject\GraphQL\MemberQueryCreator'
Expand All @@ -72,7 +72,7 @@ SilverStripe\GraphQL:
namespace MyProject\GraphQL;

use GraphQL\Type\Definition\Type;
use SilverStripe\GraphQL\QueryCreator;
use Chillu\GraphQL\QueryCreator;
use MyProject\MyDataObject;
use SilverStripe\Security\Member;

Expand Down
2 changes: 1 addition & 1 deletion _config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Name: graphqlroutes
---
SilverStripe\Control\Director:
rules:
'graphql': 'SilverStripe\GraphQL\Controller'
'graphql': 'Chillu\GraphQL\Controller'
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "silverstripe/graphql",
"name": "chillu/silverstripe-graphql",
"description": "GraphQL server for SilverStripe models and other data",
"type": "silverstripe-module",
"require": {
Expand All @@ -17,7 +17,7 @@
},
"autoload": {
"psr-4": {
"SilverStripe\\GraphQL\\": "src/"
"Chillu\\GraphQL\\": "src/"
}
},
"config": {
Expand Down
4 changes: 2 additions & 2 deletions src/Controller.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use SilverStripe\Control\Controller as BaseController;
use SilverStripe\Control\HTTPRequest;
Expand Down Expand Up @@ -45,7 +45,7 @@ public function getManager()
}

// Get a service rather than an instance (to allow procedural configuration)
$config = Config::inst()->get('SilverStripe\GraphQL', 'schema');
$config = Config::inst()->get('Chillu\GraphQL', 'schema');
$manager = Injector::inst()->create(Manager::class, $config);

return $manager;
Expand Down
2 changes: 1 addition & 1 deletion src/FieldCreator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use SilverStripe\Core\Object;
use GraphQL\Type\Definition\Type;
Expand Down
14 changes: 7 additions & 7 deletions src/Manager.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use Doctrine\Instantiator\Exception\InvalidArgumentException;
use GraphQL\Schema;
Expand All @@ -12,12 +12,12 @@
class Manager
{
/**
* @var array {@link SilverStripe\GraphQL\TypeCreator}
* @var array {@link Chillu\GraphQL\TypeCreator}
*/
protected $types = [];

/**
* @var array Map of {@link SilverStripe\GraphQL\QueryCreator}
* @var array Map of {@link Chillu\GraphQL\QueryCreator}
*/
protected $queries = [];

Expand Down Expand Up @@ -90,7 +90,7 @@ public function queryAndReturnResult($query, $params = [], $schema = null)
}

/**
* @param string|Type $type An instance of {@link SilverStripe\GraphQL\TypeCreator} (or a class name)
* @param string|Type $type An instance of {@link Chillu\GraphQL\TypeCreator} (or a class name)
* @param string $name An optional identifier for this type (defaults to class name)
*/
public function addType($type, $name = '')
Expand All @@ -105,7 +105,7 @@ public function addType($type, $name = '')

if (!($type instanceof TypeCreator)) {
throw new InvalidArgumentException(sprintf(
'The type named "%s" needs to be a class name or instance of SilverStripe\GraphQL\TypeCreator',
'The type named "%s" needs to be a class name or instance of Chillu\GraphQL\TypeCreator',
$name
));
}
Expand All @@ -124,7 +124,7 @@ public function getType($name)
}

/**
* @param string|Type $query An instance of {@link SilverStripe\GraphQL\QueryCreator} (or a class name)
* @param string|Type $query An instance of {@link Chillu\GraphQL\QueryCreator} (or a class name)
* @param string $name An optional identifier for this type (defaults to class name)
*/
public function addQuery($query, $name = '')
Expand All @@ -139,7 +139,7 @@ public function addQuery($query, $name = '')

if (!($query instanceof QueryCreator)) {
throw new InvalidArgumentException(sprintf(
'The type named "%s" needs to be a class name or instance of SilverStripe\GraphQL\QueryCreator',
'The type named "%s" needs to be a class name or instance of Chillu\GraphQL\QueryCreator',
$name
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/QueryCreator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

/**
* Represents a GraphQL query in a way that allows customisation
Expand Down
2 changes: 1 addition & 1 deletion src/TypeCreator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use SilverStripe\Core\Object;
use GraphQL\Type\Definition\ObjectType;
Expand Down
10 changes: 5 additions & 5 deletions tests/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\Controller;
use SilverStripe\GraphQL\Tests\Fake\TypeCreatorFake;
use SilverStripe\GraphQL\Tests\Fake\QueryCreatorFake;
use Chillu\GraphQL\Manager;
use Chillu\GraphQL\Controller;
use Chillu\GraphQL\Tests\Fake\TypeCreatorFake;
use Chillu\GraphQL\Tests\Fake\QueryCreatorFake;
use SilverStripe\Core\Config\Config;
use ReflectionClass;

Expand All @@ -26,7 +26,7 @@ public function testIndex()

public function testGetGetManagerPopulatesFromConfig()
{
Config::inst()->update('SilverStripe\GraphQL', 'schema', [
Config::inst()->update('Chillu\GraphQL', 'schema', [
'types' => [
'mytype' => TypeCreatorFake::class,
],
Expand Down
4 changes: 2 additions & 2 deletions tests/Fake/QueryCreatorFake.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace SilverStripe\GraphQL\Tests\Fake;
namespace Chillu\GraphQL\Tests\Fake;

use GraphQL\Type\Definition\Type;
use SilverStripe\GraphQL\QueryCreator;
use Chillu\GraphQL\QueryCreator;

class QueryCreatorFake extends QueryCreator
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Fake/TypeCreatorFake.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace SilverStripe\GraphQL\Tests\Fake;
namespace Chillu\GraphQL\Tests\Fake;

use SilverStripe\GraphQL\TypeCreator;
use Chillu\GraphQL\TypeCreator;

class TypeCreatorFake extends TypeCreator
{
Expand Down
4 changes: 2 additions & 2 deletions tests/FieldCreatorTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use SilverStripe\Dev\SapphireTest;

class FieldCreatorTest extends SapphireTest
{
public function testGetAttributesIncludesResolver()
{
$mock = $this->getMockBuilder('SilverStripe\GraphQL\FieldCreator')
$mock = $this->getMockBuilder('Chillu\GraphQL\FieldCreator')
->setMethods(['resolve'])
->getMock();
$mock->method('resolve')->willReturn(function () {
Expand Down
8 changes: 4 additions & 4 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace SilverStripe\GraphQL\Tests;
namespace Chillu\GraphQL\Tests;

use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\Tests\Fake\TypeCreatorFake;
use SilverStripe\GraphQL\Tests\Fake\QueryCreatorFake;
use Chillu\GraphQL\Manager;
use Chillu\GraphQL\Tests\Fake\TypeCreatorFake;
use Chillu\GraphQL\Tests\Fake\QueryCreatorFake;
use SilverStripe\Dev\SapphireTest;
use GraphQL\Error;
use GraphQL\Schema;
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeCreatorTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\GraphQL;
namespace Chillu\GraphQL;

use SilverStripe\Dev\SapphireTest;
use GraphQL\Type\Definition\Type;
Expand Down

0 comments on commit 27dad3b

Please sign in to comment.