src/Executor/Executor.php
protected static function getOperationRootType(Schema $schema, OperationDefinition $operation)
    {
        switch ($operation->get('operation')) {
            case 'query':
                return $schema->getQueryType();
            case 'mutation':
                $mutationType = $schema->getMutationType();
                if (!$mutationType) {
                    throw new \Exception('Schema is not configured for mutations.');
                }

                return $mutationType;
        }

        throw new \Exception('Can only execute queries and mutations.');
    }
protected static function getOperationRootType(Schema $schema, OperationDefinition $operation)
    {
        switch ($operation->get('operation')) {
            case 'query':
                return $schema->getQueryType();
            case 'mutation':
                $mutationType = $schema->getMutationType();
                if (!$mutationType) {
                    throw new \Exception('Schema is not configured for mutations.');
                }

                return $mutationType;
        }

        throw new \Exception('Can only execute queries and mutations.');
    }
protected static function getOperationRootType ( Schema $ schema , OperationDefinition $ operation ) { switch ( $ operation -> get ( 'operation' ) ) { case 'query' : return $ schema -> getQueryType ( ) ; case 'mutation' : $ mutationType = $ schema -> getMutationType ( ) ; if ( ! $ mutationType ) { throw new \ Exception ( 'Schema is not configured for mutations.' ) ; } return $ mutationType ; } throw new \ Exception ( 'Can only execute queries and mutations.' ) ; }
Extracts the root type of the operation from the schema.

@param Schema $schema
@param OperationDefinition $operation

@return ObjectType

@throws \Exception
Extracts the root type of the operation from the schema .