-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Add QueryResultItemExtensionInterface #737
Conversation
soyuka
commented
Sep 7, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | yes (think so) |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | ∅ |
License | MIT |
Doc PR | api-platform/docs#107 (second example should implement an item extension) |
a39b417
to
ce1089b
Compare
I'm adding a test for itemdataprovider once you give it a go, not sure if this would be accepted. |
* | ||
* @author Samuel ROZE <samuel.roze@gmail.com> | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface QueryResultExtensionInterface extends QueryCollectionExtensionInterface | ||
interface QueryResultExtensionInterface |
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.
Is it necessary to keep this interface? We don't have a parent class for {Item,Collection}DataProvider
.
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.
It's to avoid repeating code
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.
Imo it's better to repeat it here because creating a parent interface creates an unnecessary common type.
2b61a2e
to
954316b
Compare
May I remove this line? It's not possible to query an item without identifiers right? |
954316b
to
da2aabb
Compare
Looks fair. |
@@ -28,7 +28,7 @@ | |||
* @author Kévin Dunglas <dunglas@gmail.com> | |||
* @author Samuel ROZE <samuel.roze@gmail.com> | |||
*/ | |||
class PaginationExtension implements QueryResultExtensionInterface | |||
class PaginationExtension implements QueryResultCollectionExtensionInterface |
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.
Can you make this class final
?
da2aabb
to
820b22c
Compare
Set OrderExtension to final too. |
|
||
if (null === $identifier) { | ||
throw new InvalidArgumentException(sprintf('Invalid identifier "%s".', $id)); | ||
throw new PropertyNotFoundException(sprintf('Invalid identifier "%s", "%s" has not been found.', $id, $propertyName)); |
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'm not sure about this but it seems more a PropertyNotFound
then an InvalidArgument
. Let me know if I have to revert this.
Thanks @soyuka! |
…item Add QueryResultItemExtensionInterface