Download the PHP package api-skeletons/doctrine-graphql without Composer
On this page you can find all versions of the php package api-skeletons/doctrine-graphql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download api-skeletons/doctrine-graphql
More information about api-skeletons/doctrine-graphql
Files in api-skeletons/doctrine-graphql
Package doctrine-graphql
Short Description GraphQL Type Driver for Doctrine ORM
License MIT
Informations about the package doctrine-graphql
GraphQL Type Driver for Doctrine ORM
This project has been retired in favor of API-Skeletons/doctrine-orm-graphql
See the upgrade guide if you're a user of the 8.x branch.
All the original documentation can be found below.
This library provides a framework agnostic GraphQL driver for Doctrine ORM for use with webonyx/graphql-php. Configuration is available from zero to verbose. Multiple configurations for multiple drivers are supported.
Detailed documentation is available.
For an example application post to https://graphql.lcdb.org/
Library Highlights
- Uses PHP 8 Attributes
- Multiple independent configurations
- Support for all default Doctrine Types & custom types
- Support for the GraphQL Complete Connection Model
- Supports filtering of sub-collections
- Events for modifying queries and entity types
- Uses the Doctrine Laminas Hydrator for extraction
- Conforms to the Doctrine Coding Standard
Installation
Run the following to install this library using Composer:
Entity Relationship Diagram
This Entity Relationship Diagram, created with Skipper, is used for the query examples below and testing this library.
Quick Start
Add attributes to your Doctrine entities
Create the driver and GraphQL schema
Run GraphQL queries
Run GraphQL mutations
Filtering
For every attributed field and every attributed association, filters are available in your GraphQL query.
Example
Each field has their own set of filters. Most fields have the following:
- eq - Equals.
- neq - Not equals.
- lt - Less than.
- lte - Less than or equal to.
- gt - Greater than.
- gte - Greater than or equal to.
- isnull - Is null. If value is true, the field must be null. If value is false, the field must not be null.
- between - Between. Identical to using gte & lte on the same field. Give values as
low, high
. - in - Exists within a list of comma-delimited values.
- notin - Does not exist within a list of comma-delimited values.
- startwith - A like query with a wildcard on the right side of the value.
- endswith - A like query with a wildcard on the left side of the value.
- contains - A like query.
Events
Filter Query Builder
You may modify the query builder used to resolve any connection by subscribing to events.
Each connection may have a unique event name. Entity::class . '.filterQueryBuilder'
is recommended.
Pass as the second parameter to $driver->resolve()
.
Filter Association Criteria
You may modify the criteria object used to filter associations. For instance, if you use soft deletes then you would want to filter out deleted rows from an association.
Entity ObjectType Definition
You may modify the array used to define an entity type before it is created. This can be used for generated data and the like. You must attach to events before defining your GraphQL schema. See the detailed documentation for details.
Further Reading
Detailed documentation is available.
All versions of doctrine-graphql with dependencies
doctrine/orm Version ^2.11
doctrine/doctrine-laminas-hydrator Version ^3.2
api-skeletons/doctrine-querybuilder-filter Version ^2.0
webonyx/graphql-php Version ^v15.0
psr/container Version ^1.1||^2.0
league/event Version ^3.0