api-skeletons / zf-doctrine-graphql
3.0.0
2020-10-06 00:40 UTC
Requires
- api-skeletons/zf-doctrine-criteria: ^1.0
- doctrine/collections: ^1.5
- doctrine/common: ^2.8
- doctrine/doctrine-orm-module: ^1.1.8
- doctrine/instantiator: ^1.1
- phpro/zf-doctrine-hydration-module: ^3.0
- webonyx/graphql-php: ^0.12.0
- zendframework/zend-config: ^3.2
- zendframework/zend-hydrator: ^2.4
- zendframework/zend-modulemanager: ^2.8
- zendframework/zend-mvc-console: ^1.2
- zfcampus/zf-doctrine-querybuilder: ^1.7
Requires (Dev)
- api-skeletons/coding-standard: ^1.0
- dprevite/lint: dev-master
- php-coveralls/php-coveralls: ^2.1
- phpstan/phpstan-doctrine: ^0.10
- phpunit/phpunit: ^7.1
- zendframework/zend-test: ^3.2
README
这个库使用 Doctrine 的原生相关对象遍历来提供实体的完整 GraphQL 查询以及所有相关字段和实体。实体元数据是内省的,因此对 Doctrine 数据驱动程序无关。数据通过 hydrators 收集,从而允许通过 hydrator 过滤器、策略和命名策略对每个字段进行完全控制。支持多个对象管理器。支持多个 hydrator 配置。与 GraphiQL 兼容。
提供了一系列过滤器,可以在查询的任何位置过滤集合。
Doctrine 提供了轻松遍历数据库的方法。考虑以下假设查询
$entity[where id = 5] ->getRelation() ->getField1() ->getField2() ->getManyToOne([where name like '%dev%']) ->getName() ->getField3() ->getOtherRelation() ->getField4() ->getField5()
并在 GraphQL 中实现,通过 hydrators 对每个字段进行精细控制
{ entity (filter: { id: 5 }) { relation { field1 field2 manyToOne (filter: { name_contains: 'dev' }) { name field3 } } otherRelation { field4 field5 } } }