-
Notifications
You must be signed in to change notification settings - Fork 104
Exception on duplicate queries #181
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
Exception on duplicate queries #181
Conversation
Looks like i found a bug in the testing suite: /**
* @Query(name="arrayObject")
* @return ArrayObject|TestObject[]
*/
public function testArrayObject(): ArrayObject
{
return new ArrayObject([]);
}
/**
* @Query(name="arrayObject")
* @return iterable|TestObject[]
*/
public function testIterable(): iterable
{
return array();
} from Same query name here, i will fix this with the next commit |
The GraphQLite bundle tests fails in Travis, i'll have a look later |
a6251d2
to
08417a4
Compare
Hey @moufmouf, |
Hey @flow-control , Thanks a lot for the PR! Right now, this PR can detect naming conflicts inside a class. I'm still trying to figure out the simplest way to do this. |
I hear you, and I thought about it and I had a total different idea. Why do we see this as a problem at all? Possibly only because if you do so (using But we could go another way an document this as a feature. If you are using GraphQLite in a project as we do, that may be extended by plugins, this "feature" allows to override queries and fields from the core, by just annotating it with the same name. The only problem left is to make this predictable because the default namespace mapper should scan in alphabetical order - which is neither explicit nor predictable. But because the Just my thoughts about this, but what do you think about seeing it from this point of view? If you like the idea, i would be willing to try this out and write tests for this case :-) Hope this all makes sense ;-) |
Hey @flow-control , Sorry for the long delay in the answer, I've had a couple of hectic weeks.
Well, I like the idea that one can "override" the queries provided by someone else. This is particularly important if at some point, we have queries / mutations provided by third party packages (in the "vendor/" directory). However, I feel that if 2 controllers are next to each other, in the same directory, there is no real reason why I would favor one query over the other. So, what we are saying here is that the detection of duplicates should be also performed at the Anyway, your PR, is it stands is already a good improvement. I'll merge it as-is and open a new issue for the Thanks a lot for this PR! |
This pull request adds an exception in case there are duplicate queries defined in your controller as specified in #175