GraphQLBundle icon indicating copy to clipboard operation
GraphQLBundle copied to clipboard

Use custom scalar DateTime

Open VincentClair opened this issue 8 years ago • 4 comments

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 ?

VincentClair avatar Feb 22 '17 11:02 VincentClair

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

mcg-web avatar Feb 22 '17 11:02 mcg-web

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"] ?

VincentClair avatar Feb 22 '17 11:02 VincentClair

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

mcg-web avatar Feb 22 '17 13:02 mcg-web

@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

murtukov avatar Jul 08 '20 01:07 murtukov