Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized implementation to interfaces loading #33

Merged

Conversation

mcg-web
Copy link
Collaborator

@mcg-web mcg-web commented Apr 19, 2016

  • Optimized implementation to interfaces using lazy loader.
  • Union types now accepting callback

@mcg-web mcg-web force-pushed the lazy_implementation_to_interfaces_loading branch from adb18a5 to 3c6305c Compare April 19, 2016 19:26
@vladar
Copy link
Member

vladar commented Apr 20, 2016

I am ready yo merge this, but just curious - what is your use case that requires lazy initialization of interface implementations?

@mcg-web
Copy link
Collaborator Author

mcg-web commented Apr 20, 2016

The use case is simple, let say we have this:

interface A {}
type B implement A {}
$b = new ObjectType([
      "name" => "B",
      "fields" => [/*...*/],
      "interfaces" => function() { /* Some Magic loader */ },
]);

$a = new InterfaceType([
      "name" => "A",
      "fields" => [/*...*/],
]);

This will not work because B is declared before A...
The Lazy Loader allow this, because objects interfaces will be treated only when really needed in the schema.

@vladar
Copy link
Member

vladar commented Apr 20, 2016

Yeah, looks like you are right. I will also rework test case for interface definition via Closure to check for this.

@vladar vladar merged commit 0a0c818 into webonyx:master Apr 20, 2016
@mcg-web mcg-web deleted the lazy_implementation_to_interfaces_loading branch April 20, 2016 12:03
@mcg-web
Copy link
Collaborator Author

mcg-web commented Apr 20, 2016

Yes the test will help for no BC on later modifications 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants