-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from TomHAnderson/feature/custom-doctrine-types
Feature/custom doctrine types
- Loading branch information
Showing
6 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Custom Mapping Types | ||
==================== | ||
|
||
Doctrine allows `Custom Mapping Types <https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/custom-mapping-types.html>`_ | ||
To support Custom Mapping Types you must implement ''ZF\Doctrine\GraphQL\Type\CustomTypeInterface'' | ||
on your Custom Doctrine Mapping Type field. This must return a scalar GraphQL type for the custom type. | ||
|
||
Additionally you must create a custom GraphQL type for the field for handling serialization, etc. | ||
See ''ZF\Doctrine\GraphQL\Type\DateTimeType'' for an example of a custom GraphQL type. | ||
|
||
Add the new custom GraphQL type to your configuration:: | ||
|
||
'zf-doctrine-graphql-type' => [ | ||
'invokables' => [ | ||
'datetime_microsecond' => Types\GraphQL\DateTimeMicrosecondType::class, | ||
], | ||
], | ||
|
||
|
||
.. role:: raw-html(raw) | ||
:format: html | ||
|
||
.. note:: | ||
Authored by `API Skeletons <https://apiskeletons.com>`_. All rights reserved. | ||
|
||
|
||
:raw-html:`<script async src="https://www.googletagmanager.com/gtag/js?id=UA-64198835-4"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-64198835-4');</script>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* To use GraphQL with a custom Doctrine type | ||
* implement this interface on the custom doctrine Type | ||
*/ | ||
|
||
namespace ZF\Doctrine\GraphQL\Type; | ||
|
||
interface CustomTypeInterface | ||
{ | ||
public function mapGraphQLFieldType(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters