Skip to content
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

Merged

Conversation

GuySartorelli
Copy link
Member

Comment on lines -5 to -12
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;
Copy link
Member Author

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);
Copy link
Member Author

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

@emteknetnz emteknetnz merged commit 78af3f9 into silverstripe:5.2 Jan 29, 2025
12 checks passed
@emteknetnz emteknetnz deleted the pulls/5.2/static-not-self branch January 29, 2025 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants