-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Use static call not self call when rebuilding schema #624
FIX Use static call not self call when rebuilding schema #624
Conversation
d6f1a3e
to
8daec3d
Compare
use GraphQL\Type\Definition\AbstractType; | ||
use Exception; | ||
use SilverStripe\Control\Controller; | ||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\GraphQL\Schema\Storage\AbstractTypeRegistry; | ||
use SilverStripe\GraphQL\Controller as GraphQLController; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use ReflectionObject; | ||
use stdClass; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GraphQL\Type\Definition\AbstractType
and stdClass
were unused, so I've removed them.
$graphqlController = new GraphQLController('test'); | ||
|
||
// autobuild | ||
$graphqlController->setAutobuildSchema($autobuild); | ||
|
||
// controller | ||
if ($controller) { | ||
// Make it so that Controller::curr() returns a GraphQLController | ||
$fakeSession = new Session([]); | ||
$request = Controller::curr()->getRequest(); | ||
$request->setSession($fakeSession); | ||
$graphqlController->setRequest($request); | ||
$graphqlController->pushCurrent(); | ||
} | ||
$this->prepGraphQLController($controller, $autobuild); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to reuse this code so I've moved it into a new private method
Issue