mathsgod/graphqlite-laminas-paginator-type

1.0.0 2022-04-19 08:47 UTC

This package is auto-updated.

Last update: 2024-09-19 14:11:37 UTC


README

设置

use Laminas\Paginator\Mappers\TypeMapperFactory;
use TheCodingMachine\GraphQLite\SchemaFactory;

$factory = new SchemaFactory($cache, $container);
$factory->addTypeMapperFactory(new TypeMapperFactory); // add type mapper

示例

//Controller class
class Root{
    #[Query()]
    /**
     * @return Product[]
     */
    function products():Paginator{
        //get the products paginator
        return $paginator;
    }
}

//Type class
#[Type]
class Product{
    #[Field]
    public string $name
}
query{
    products{
        items(limit:5,offset:10){
            name
        }
        count
    }
}