-
Notifications
You must be signed in to change notification settings - Fork 523
Added: DefaultResultFactory and MultipleResultFactory classes - Fix #223 #229
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, mark the method as final is not really necessary. WDY @willdurand @toin0u
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept this because of @willdurand's comment: #182 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you wrote here that the use should extend from this class to implement his own logic, but this isn't possible with final.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes createFromArray can't be extended but newInstance can as I did here: https://github.com/toin0u/Geotools/blob/master/src/Geotools/Batch/BatchResult.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to provide its own ResultInterface instance, not to change the data type returned by the factory. So I think it's correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@willdurand Then it would be better to mark the class as final and write it down to the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well there is now ResultFactoryInterface so it's possible to mark DefaultResultFactory and MultipleResultFactory as final but it will introduce a BC break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toin0u Good catch! Its not worth enough to introduce a BC break, but we should update the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Baachi You're totaly right ! We need to update the docs 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs updated. Is it good enough ?
Added: DefaultResultFactory and MultipleResultFactory classes - Fix #223
|
Perfect, thank you! |
|
@Baachi @willdurand Thanks :) |
|
Perfect 👍 |
|
mmh, we should update the providers, isn'it? |
|
Yes... And we should update the doc because not every providers return multilple results. |
|
Ok I'm looking for this and we have a problem when:
Should we throw an exception in the factory ? Or should factories be more similar by using |
|
I would avoid a BC break. Maybe exceptions are the way to go. |
|
I don't understand.
then, there will be a collection with one item, no problem
then, the first one will be used, which is the current behavior |
|
I understand what you mean but the problem is:
This GoogleMapsProvoder returns:
So if you got one result with I hope I was clear enough and you can see this point :) |
|
No I still don't understand, each provider should return an array of arrays. |
|
It's true, it's my mistake, I should wrote array of arrays and array of associate arrays. Single result: Multiple results: |
|
Providers HAVE TO return all results. The Factory makes the final decision. |
|
I understand what you meant now. We misunderstood each other because I was exposing a problem when providers return one or multiple results.. And you already assumed that providers return all results :) |
Hi,
What do you think @willdurand @Baachi @mrkrstphr ?
Thanks to @Baachi for his idea :)
Btw tests are fixed by #228