Skip to content

Add notice about custom entity identifier in data-providers.md #192

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

Merged
merged 2 commits into from
Apr 11, 2017

Conversation

kate-kate
Copy link
Contributor

@kate-kate kate-kate commented Apr 11, 2017

Add notice about custom entity identifier
@@ -17,7 +17,7 @@ For a given resource, you can implement two kind of interfaces:
* the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/master/src/DataProvider/ItemDataProviderInterface.php)
is used when fetching items.

In the following examples we will create custom data providers for an entity class class called `AppBundle\Entity\BlogPost`.
In the following examples we will create custom data providers for an entity class class called `AppBundle\Entity\BlogPost`. Notice, that you need to set `identifier` attribute as it was described at [Entity Identifier Case](serialization-groups-and-relations.md#entity-identifier-case) section for your custom entity class to work properly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about:

Note that if you entity is not doctrine-related, you need to flag the identifier property by using @ApiProperty(identifiier=true) for things to work properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think your variant is better

@soyuka soyuka merged commit 854b4d4 into api-platform:master Apr 11, 2017
@soyuka
Copy link
Member

soyuka commented Apr 11, 2017

Thanks @kate-kate

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