Skip to content

name field is not defined in offer #684

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 1 commit into from
Dec 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions core/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;

/**
* @ApiResource()
* @ApiFilter(SearchFilter::class, properties={"id": "exact", "price": "exact", "name": "partial"})
* @ApiFilter(SearchFilter::class, properties={"id": "exact", "price": "exact", "description": "partial"})
*/
class Offer
{
Expand All @@ -163,10 +163,9 @@ class Offer
```

`http://localhost:8000/api/offers?price=10` will return all offers with a price being exactly `10`.
`http://localhost:8000/api/offers?name=shirt` will return all offers with a description containing the word "shirt".
`http://localhost:8000/api/offers?name[]=shirt&name[]=sweat` will return all offers with a description containing the word "shirt" or containing the word "sweat".
`http://localhost:8000/api/offers?description=shirt` will return all offers with a description containing the word "shirt".

Filters can be combined together: `http://localhost:8000/api/offers?price=10&name=shirt`
Filters can be combined together: `http://localhost:8000/api/offers?price=10&description=shirt`

It is possible to filter on relations too, if `Offer` has a `Product` relation:

Expand Down