mathsgod/graphqlite-laminas-paginator-type

1.0.0 2022-04-19 08:47 UTC

This package is auto-updated.

Last update: 2024-04-19 13:21:27 UTC


README

Setup

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

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

Example

//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
    }
}