public function create(string $className, string $typeName): Type
    {
        $type = new InputObjectType([
            'name' => $typeName,
            'fields' => function () use ($className, $typeName): array {
                $fieldsEnum = new EnumType([
                    'name' => $typeName . 'Field',
                    'values' => $this->getPossibleValues($className),
                    'description' => 'Fields available for `' . $typeName . '`',
                ]);
                $this->types->registerInstance($fieldsEnum);

                return [
                    [
                        'name' => 'field',
                        'type' => Type::nonNull($fieldsEnum),
                    ],
                    [
                        'name' => 'nullAsHighest',
                        'type' => Type::boolean(),
                        'description' => 'If true `NULL` values will be considered as the highest value, so appearing last in a `ASC` order, and first in a `DESC` order.',
                        'defaultValue' => false,
                    ],
                    [
                        'name' => 'order',
                        'type' => $this->types->get('SortingOrder'),
                        'defaultValue' => 'ASC',
                    ],
                ];
            },
        ]);

        return $type;
    }
public function create(string $className, string $typeName): Type
    {
        $type = new InputObjectType([
            'name' => $typeName,
            'fields' => function () use ($className, $typeName): array {
                $fieldsEnum = new EnumType([
                    'name' => $typeName . 'Field',
                    'values' => $this->getPossibleValues($className),
                    'description' => 'Fields available for `' . $typeName . '`',
                ]);
                $this->types->registerInstance($fieldsEnum);

                return [
                    [
                        'name' => 'field',
                        'type' => Type::nonNull($fieldsEnum),
                    ],
                    [
                        'name' => 'nullAsHighest',
                        'type' => Type::boolean(),
                        'description' => 'If true `NULL` values will be considered as the highest value, so appearing last in a `ASC` order, and first in a `DESC` order.',
                        'defaultValue' => false,
                    ],
                    [
                        'name' => 'order',
                        'type' => $this->types->get('SortingOrder'),
                        'defaultValue' => 'ASC',
                    ],
                ];
            },
        ]);

        return $type;
    }
public function create ( string $ className , string $ typeName ) : Type { $ type = new InputObjectType ( [ 'name' => $ typeName , 'fields' => function ( ) use ( $ className , $ typeName ) : array { $ fieldsEnum = new EnumType ( [ 'name' => $ typeName . 'Field' , 'values' => $ this -> getPossibleValues ( $ className ) , 'description' => 'Fields available for `' . $ typeName . '`' , ] ) ; $ this -> types -> registerInstance ( $ fieldsEnum ) ; return [ [ 'name' => 'field' , 'type' => Type :: nonNull ( $ fieldsEnum ) , ] , [ 'name' => 'nullAsHighest' , 'type' => Type :: boolean ( ) , 'description' => 'If true `NULL` values will be considered as the highest value, so appearing last in a `ASC` order, and first in a `DESC` order.' , 'defaultValue' => false , ] , [ 'name' => 'order' , 'type' => $ this -> types -> get ( 'SortingOrder' ) , 'defaultValue' => 'ASC' , ] , ] ; } , ] ) ; return $ type ; }
Create an InputObjectType from a Doctrine entity to
sort them by their fields and custom sorter.

@param string $className class name of Doctrine entity
@param string $typeName GraphQL type name

@return InputObjectType
Create an InputObjectType from a Doctrine entity to sort them by their fields and custom sorter .