overblog / GraphQLBundle

This bundle provides tools to build a complete GraphQL API server in your Symfony App.
MIT License
788 stars 222 forks source link

Use custom scalar DateTime #120

Open VincentClair opened 7 years ago

VincentClair commented 7 years ago
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? no
Version/Branch 0.7.1

Hello,

How to define custom scalar type ? We followed the example in test suite but in place of the date time in query response, we get this:

    ...
    startDateTime: ["Acme\\AppBundle\\GraphQL\\Type\\DateTimeType", "serialize"]
    ...

If we send parameters for a mutation, the datetime in database is null.

Did we miss something ?

mcg-web commented 7 years ago

Hi @VincentClair, the method Acme\AppBundle\GraphQL\Type\DateTimeType::serialize is callable ?

VincentClair commented 7 years ago

Thank you for your quick reply. And sorry, we missed the good namespace !! We get the good value now for query.

If the serialize is not found, could the service send an error in place of the actual serialize definition ["Acme\\AppBundle\\GraphQL\\Type\\DateTimeType", "serialize"] ?

mcg-web commented 7 years ago

yes must work on this, missing error to help developers debugging...

murtukov commented 4 years ago

@VincentClair

If you mean throwing an exception when ["Acme\\AppBundle\\GraphQL\\Type\\DateTimeType", "serialize"] is not callable, then it's implemented in 1.0 and this issue can be closed.

@mcg-web ping