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

Add QueryResultItemExtensionInterface #737

Merged
merged 1 commit into from
Sep 8, 2016

Conversation

soyuka
Copy link
Member

@soyuka 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)

@soyuka
Copy link
Member Author

soyuka commented Sep 7, 2016

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
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

@soyuka soyuka force-pushed the add-result-extension-item branch 3 times, most recently from 2b61a2e to 954316b Compare September 8, 2016 08:27
@soyuka
Copy link
Member Author

soyuka commented Sep 8, 2016

May I remove this line? It's not possible to query an item without identifiers right?

@dunglas
Copy link
Member

dunglas commented Sep 8, 2016

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
Copy link
Member

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?

@soyuka
Copy link
Member Author

soyuka commented Sep 8, 2016

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));
Copy link
Member Author

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.

@dunglas dunglas merged commit 399d4b3 into api-platform:master Sep 8, 2016
@dunglas
Copy link
Member

dunglas commented Sep 8, 2016

Thanks @soyuka!

@soyuka soyuka deleted the add-result-extension-item branch September 9, 2016 16:01
magarzon pushed a commit to magarzon/core that referenced this pull request Feb 12, 2017
…item

Add QueryResultItemExtensionInterface
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.

None yet

2 participants