Skip to content

Commit f9d17c8

Browse files
committed
fixed typos and broken links
1 parent 25bd64f commit f9d17c8

16 files changed

+132
-133
lines changed

core/data-persisters.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ A [Doctrine MongoDB ODM](https://www.doctrine-project.org/projects/mongodb-odm.h
1111

1212
However, you may want to:
1313

14-
* store data to other persistence layers (ElasticSearch, external web services...)
14+
* store data to other persistence layers (Elasticsearch, external web services...)
1515
* not publicly expose the internal model mapped with the database through the API
1616
* use a separate model for [read operations](data-providers.md) and for updates by implementing patterns such as [CQRS](https://martinfowler.com/bliki/CQRS.html)
1717

18-
Custom data persisters can be used to do so. A project can include as many data persisters as it needs. The first able to
18+
Custom data persisters can be used to do so. A project can include as many data persisters as needed. The first able to
1919
persist data for a given resource will be used.
2020

2121
## Creating a Custom Data Persister
@@ -25,7 +25,7 @@ This interface defines only 3 methods:
2525

2626
* `persist`: to create or update the given data
2727
* `remove`: to delete the given data
28-
* `support`: checks whether the given data is supported by this data persister
28+
* `support`: to check whether the given data is supported by this data persister
2929

3030
Here is an implementation example:
3131

core/data-providers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ ORM](http://www.doctrine-project.org/projects/orm.html) to retrieve data from a
55
[Doctrine MongoDB ODM](https://www.doctrine-project.org/projects/mongodb-odm.html) to retrieve data from a document
66
database, and a data provider using [Elasticsearch-PHP](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html)
77
to retrieve data from an Elasticsearch cluster are included with the library. The first one is enabled by default. These
8-
data providers natively support paged collections and filters. They can be used as is and fits perfectly with common usages.
8+
data providers natively support paged collections and filters. They can be used as-is and are perfectly suited to common uses.
99

10-
However, you sometime want to retrieve data from other sources such as another persistence layer or a webservice.
11-
Custom data providers can be used to do so. A project can include as many data providers as it needs. The first able to
10+
However, you sometimes want to retrieve data from other sources such as another persistence layer or a webservice.
11+
Custom data providers can be used to do so. A project can include as many data providers as needed. The first able to
1212
retrieve data for a given resource will be used.
1313

14-
For a given resource, you can implement two kind of interfaces:
14+
For a given resource, you can implement two kinds of interface:
1515

1616
* the [`CollectionDataProviderInterface`](https://github.com/api-platform/core/blob/master/src/DataProvider/CollectionDataProviderInterface.php)
1717
is used when fetching a collection.
1818
* the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/master/src/DataProvider/ItemDataProviderInterface.php)
1919
is used when fetching items.
2020

21-
Both implementations can also implement a third, optional interface called
21+
Both implementations can also implement a third, optional, interface called
2222
['RestrictedDataProviderInterface'](https://github.com/api-platform/core/blob/master/src/DataProvider/RestrictedDataProviderInterface.php)
2323
if you want to limit their effects to a single resource or operation.
2424

@@ -167,7 +167,7 @@ final class BlogPostItemDataProvider implements ItemDataProviderInterface, Seria
167167
## Injecting Extensions (Pagination, Filter, EagerLoading etc.)
168168

169169
ApiPlatform provides a few extensions that you can reuse in your custom DataProvider.
170-
Note that there are a few kind of extensions which are detailed in [their own chapter of the documentation](extensions.md).
170+
Note that there are a few kinds of extensions which are detailed in [their own chapter of the documentation](extensions.md).
171171
Because extensions are tagged services, you can use the [injection of tagged services](https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services):
172172

173173
```yaml

core/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For [Rapid Application Development](https://en.wikipedia.org/wiki/Rapid_applicat
3232
**if and only if the class marked with `@ApiResource` is also a Doctrine entity**, the developer can use the Doctrine
3333
ORM's data provider and persister implementations shipped with API Platform.
3434

35-
In this case, the public (`@ApiResource`) and internal (Doctrine entity) data model are shared. Then, API Platform will
35+
In this case, the public (`@ApiResource`) and internal (Doctrine entity) data models are shared. Then, API Platform will
3636
be able to query, filter, paginate and persist data automatically.
3737
This approach is super-convenient and efficient, but is probably **not a good idea** for non-[CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)
3838
and/or large systems.

core/filters.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Filters
22

33
API Platform Core provides a generic system to apply filters on collections. Useful filters for the Doctrine ORM and
4-
MongoDB ODM are provided with the library. You can also create custom filters that would fit your specific needs.
4+
MongoDB ODM are provided with the library. You can also create custom filters that fit your specific needs.
55
You can also add filtering support to your custom [data providers](data-providers.md) by implementing interfaces provided
66
by the library.
77

@@ -127,19 +127,19 @@ If Doctrine ORM or MongoDB ODM support is enabled, adding filters is as easy as
127127

128128
The search filter supports `exact`, `partial`, `start`, `end`, and `word_start` matching strategies:
129129

130-
* `partial` strategy uses `LIKE %text%` to search for fields that containing the text.
131-
* `start` strategy uses `LIKE text%` to search for fields that starts with text.
132-
* `end` strategy uses `LIKE %text` to search for fields that ends with text.
133-
* `word_start` strategy uses `LIKE text% OR LIKE % text%` to search for fields that contains the word starting with `text`.
130+
* `partial` strategy uses `LIKE %text%` to search for fields that contain `text`.
131+
* `start` strategy uses `LIKE text%` to search for fields that start with `text`.
132+
* `end` strategy uses `LIKE %text` to search for fields that end with `text`.
133+
* `word_start` strategy uses `LIKE text% OR LIKE % text%` to search for fields that contain words starting with `text`.
134134

135135
Prepend the letter `i` to the filter if you want it to be case insensitive. For example `ipartial` or `iexact`. Note that
136136
this will use the `LOWER` function and **will** impact performance [if there is no proper index](performance.md#search-filter).
137137

138138
Case insensitivity may already be enforced at the database level depending on the [collation](https://en.wikipedia.org/wiki/Collation)
139139
used. If you are using MySQL, note that the commonly used `utf8_unicode_ci` collation (and its sibling `utf8mb4_unicode_ci`)
140-
are already case insensitive, as indicated by the `_ci` part in their names.
140+
are already case-insensitive, as indicated by the `_ci` part in their names.
141141

142-
Note: Search filters with the exact strategy can have multiple values for a same property (in this case the condition will be similar to a SQL IN clause).
142+
Note: Search filters with the `exact` strategy can have multiple values for the same property (in this case the condition will be similar to a SQL IN clause).
143143

144144
Syntax: `?property[]=foo&property[]=bar`
145145

@@ -191,22 +191,22 @@ class Offer
191191
```
192192

193193
With this service definition, it is possible to find all offers belonging to the product identified by a given IRI.
194-
Try the following: `http://localhost:8000/api/offers?product=/api/products/12`
194+
Try the following: `http://localhost:8000/api/offers?product=/api/products/12`.
195195
Using a numeric ID is also supported: `http://localhost:8000/api/offers?product=12`
196196

197-
Previous URLs will return all offers for the product having the following IRI as JSON-LD identifier (`@id`): `http://localhost:8000/api/products/12`.
197+
The above URLs will return all offers for the product having the following IRI as JSON-LD identifier (`@id`): `http://localhost:8000/api/products/12`.
198198

199199
### Date Filter
200200

201-
The date filter allows for filtering a collection by date intervals.
201+
The date filter allows to filter a collection by date intervals.
202202

203203
Syntax: `?property[<after|before|strictly_after|strictly_before>]=value`
204204

205205
The value can take any date format supported by the [`\DateTime` constructor](http://php.net/manual/en/datetime.construct.php).
206206

207207
The `after` and `before` filters will filter including the value whereas `strictly_after` and `strictly_before` will filter excluding the value.
208208

209-
As others filters, the date filter must be explicitly enabled:
209+
Like others filters, the date filter must be explicitly enabled:
210210

211211
```php
212212
<?php
@@ -245,7 +245,7 @@ Consider items as oldest | `ApiPlatform\Core\Bridge\Doctrine\Orm\Fil
245245
Consider items as youngest | `ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_AFTER` (`include_null_after`)
246246
Always include items | `ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_BEFORE_AND_AFTER` (`include_null_before_and_after`)
247247

248-
For instance, exclude entries with a property value of `null`, with the following service definition:
248+
For instance, exclude entries with a property value of `null` with the following service definition:
249249

250250
```php
251251
<?php
@@ -359,15 +359,15 @@ class Offer
359359
}
360360
```
361361

362-
Given that the collection endpoint is `/offers`, you can filters the price with the following query: `/offers?price[between]=12.99..15.99`.
362+
Given that the collection endpoint is `/offers`, you can filter the price with the following query: `/offers?price[between]=12.99..15.99`.
363363

364364
It will return all offers with `price` between 12.99 and 15.99.
365365

366366
You can filter offers by joining two values, for example: `/offers?price[gt]=12.99&price[lt]=19.99`.
367367

368368
### Exists Filter
369369

370-
The exists filter allows you to select items based on nullable field value.
370+
The exists filter allows you to select items based on a nullable field value.
371371

372372
Syntax: `?property[exists]=<true|false|1|0>`
373373

@@ -553,9 +553,9 @@ class Offer
553553
}
554554
```
555555

556-
**Note: Filters on nested properties must still be enabled explicitly, in order to keep things sane**
556+
**Note: Filters on nested properties must still be enabled explicitly, in order to keep things sane.**
557557

558-
Regardless of this option, filters can by applied on a property only if:
558+
Regardless of this option, filters can be applied on a property only if:
559559

560560
* the property exists
561561
* the value is supported (ex: `asc` or `desc` for the order filters).
@@ -1003,12 +1003,12 @@ class AndOperatorFilterExtension implements RequestBodySearchCollectionExtension
10031003

10041004
### Using Doctrine ORM Filters
10051005

1006-
Doctrine ORM features [a filter system](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/filters.html) that allows the developer to add SQL to the conditional clauses of queries, regardless the place where the SQL is generated (e.g. from a DQL query, or by loading associated entities).
1007-
These are applied on collections and items, so are incredibly useful.
1006+
Doctrine ORM features [a filter system](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/filters.html) that allows the developer to add SQL to the conditional clauses of queries, regardless of the place where the SQL is generated (e.g. from a DQL query, or by loading associated entities).
1007+
These are applied on collections and items and therefore are incredibly useful.
10081008

10091009
The following information, specific to Doctrine filters in Symfony, is based upon [a great article posted on Michaël Perrin's blog](http://blog.michaelperrin.fr/2014/12/05/doctrine-filters/).
10101010

1011-
Suppose we have a `User` entity and an `Order` entity related to the `User` one. A user should only see his orders and no others's ones.
1011+
Suppose we have a `User` entity and an `Order` entity related to the `User` one. A user should only see his orders and no one else's.
10121012

10131013
```php
10141014
<?php
@@ -1157,7 +1157,7 @@ doctrine:
11571157
class: App\Filter\UserFilter
11581158
```
11591159

1160-
And add a listener for every request that initializes the Doctrine filter with the current user in your bundle services declaration file.
1160+
Add a listener for every request that initializes the Doctrine filter with the current user in your bundle services declaration file.
11611161

11621162
```yaml
11631163
# api/config/services.yaml
@@ -1266,13 +1266,13 @@ class DummyCar
12661266
12671267
```
12681268

1269-
On the first property, `name`, it's straightforward. The first annotation argument is the filter class, the second specifies options, here the strategy:
1269+
On the first property, `name`, it's straightforward. The first annotation argument is the filter class, the second specifies options, here, the strategy:
12701270

12711271
```
12721272
@ApiFilter(SearchFilter::class, strategy="partial")
12731273
```
12741274

1275-
The second annotation, we specify `properties` on which the filter should apply. It's necessary here because we don't want to filter `colors` but the property `prop` of the `colors` association.
1275+
In the second annotation, we specify `properties` on which the filter should apply. It's necessary here because we don't want to filter `colors` but the `prop` property of the `colors` association.
12761276
Note that for each given property we specify the strategy:
12771277

12781278
```
@@ -1314,13 +1314,13 @@ class DummyCar
13141314
13151315
```
13161316

1317-
The `BooleanFilter` is applied to every `Boolean` property of the class. Indeed, in each core filters we check the Doctrine type. It's written only by using the filter class:
1317+
The `BooleanFilter` is applied to every `Boolean` property of the class. Indeed, in each core filter we check the Doctrine type. It's written only by using the filter class:
13181318

13191319
```
13201320
@ApiFilter(BooleanFilter::class)
13211321
```
13221322

1323-
The `DateFilter` given here will be applied to every `Date` property of the class `DummyCar` with the `DateFilter::EXCLUDE_NULL` strategy:
1323+
The `DateFilter` given here will be applied to every `Date` property of the `DummyCar` class with the `DateFilter::EXCLUDE_NULL` strategy:
13241324

13251325
```
13261326
@ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
@@ -1334,7 +1334,7 @@ The `SearchFilter` here adds properties. The result is the exact same as the exa
13341334

13351335
Note that you can specify the `properties` argument on every filter.
13361336

1337-
The next filters are not related to how the data is fetched but rather on the how the serialization is done on those, we can give an `arguments` option ([see here for the available arguments](#serializer-filters)):
1337+
The next filters are not related to how the data is fetched but rather to how the serialization is done on those. We can give an `arguments` option ([see here for the available arguments](#serializer-filters)):
13381338

13391339
```
13401340
@ApiFilter(PropertyFilter::class, arguments={"parameterName": "foobar"})

core/getting-started.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
## Installing API Platform Core
44

55
If you are starting a new project, the easiest way to get API Platform up is to install the [API Platform Distribution](../distribution/index.md).
6-
It ships with the API Platform Core library integrated with [the Symfony framework](https://symfony.com), [the schema generator](../schema-generator/),
6+
It comes with the API Platform Core library integrated with [the Symfony framework](https://symfony.com), [the schema generator](../schema-generator/),
77
[Doctrine ORM](http://www.doctrine-project.org), [Elasticsearch-PHP](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html),
88
[NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle) and [Behat](http://behat.org).
99
[Doctrine MongoDB ODM](https://www.doctrine-project.org/projects/mongodb-odm.html) can also be enabled by following the [MongoDB documentation](mongodb.md).
1010
Basically, it is a Symfony edition packaged with the best tools to develop a REST API and sensible default settings.
1111

12-
Alternatively, you can use [Composer](http://getcomposer.org) to install the standalone bundle in an existing Symfony Flex
12+
Alternatively, you can use [Composer](http://getcomposer.org) to install the stand-alone bundle in an existing Symfony Flex
1313
project:
1414

1515
`composer require api`
1616

17-
There is no mandatory configuration options although [many settings are available](configuration.md).
17+
There are no mandatory configuration options although [many settings are available](configuration.md).
1818

1919
## Before Reading this Documentation
2020

@@ -70,15 +70,15 @@ class Product // The class name will be used to name exposed resources
7070

7171
public function __construct()
7272
{
73-
$this->offers = new ArrayCollection(); // Initialize $offers as an Doctrine collection
73+
$this->offers = new ArrayCollection(); // Initialize $offers as a Doctrine collection
7474
}
7575

7676
public function getId(): ?int
7777
{
7878
return $this->id;
7979
}
8080

81-
// Adding both an adder and a remover as well as updating the reverse relation are mandatory
81+
// Adding both an adder and a remover as well as updating the reverse relation is mandatory
8282
// if you want Doctrine to automatically update and persist (thanks to the "cascade" option) the related entity
8383
public function addOffer(Offer $offer): void
8484
{
@@ -147,18 +147,18 @@ web API.
147147
If you are familiar with the Symfony ecosystem, you noticed that entity classes are also mapped with Doctrine ORM annotations
148148
and validation constraints from [the Symfony Validator Component](http://symfony.com/doc/current/book/validation.html).
149149
This isn't mandatory. You can use [your preferred persistence](data-providers.md) and [validation](validation.md) systems.
150-
However, API Platform Core has built-in support for those library and is able to use them without requiring any specific
151-
code or configuration to automatically persist and validate your data. They are good default and we encourage you to use
150+
However, API Platform Core has built-in support for those libraries and is able to use them without requiring any specific
151+
code or configuration to automatically persist and validate your data. They are a good default option and we encourage you to use
152152
them unless you know what you are doing.
153153

154154
Thanks to the mapping done previously, API Platform Core will automatically register the following REST [operations](operations.md)
155155
for resources of the product type:
156156

157-
Product
157+
*Product*
158158

159159
Method | URL | Description
160160
-------|----------------|--------------------------------
161-
GET | /products | Retrieve the (paged) collection
161+
GET | /products | Retrieve the (paginated) collection
162162
POST | /products | Create a new product
163163
GET | /products/{id} | Retrieve a product
164164
PUT | /products/{id} | Update a product
@@ -184,7 +184,7 @@ XML:
184184
<resource
185185
class="App\Entity\Offer"
186186
shortName="Offer" <!-- optional -->
187-
description="An offer form my shop" <!-- optional -->
187+
description="An offer from my shop" <!-- optional -->
188188
iri="http://schema.org/Offer" <!-- optional -->
189189
/>
190190
</resources>
@@ -222,6 +222,6 @@ If you want to serialize only a subset of your data, please refer to the [Serial
222222
You now have a fully featured API exposing your entities.
223223
Run the Symfony app (`bin/console server:run`) and browse the API entrypoint at `http://localhost:8000/api`.
224224

225-
Interact with the API using a REST client (we recommend [Postman](https://www.getpostman.com/)) or an Hydra aware application
225+
Interact with the API using a REST client (we recommend [Postman](https://www.getpostman.com/)) or an Hydra-aware application
226226
(you should give [Hydra Console](https://github.com/lanthaler/HydraConsole) a try). Take
227227
a look at the usage examples in [the `features` directory](https://github.com/api-platform/core/tree/master/features).

core/graphql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[GraphQL](http://graphql.org/) is a query language made to communicate with an API and therefore is an alternative to REST.
66

7-
It has some advantages compared to REST: it solves the over-fetching or under-fetching of data, is strongly typed, and is capable of retrieving multiple and nested data in one time; but it also comes with drawbacks: for example it creates overhead depending of the request.
7+
It has some advantages compared to REST: it solves the over-fetching or under-fetching of data, is strongly typed, and is capable of retrieving multiple and nested data in one go, but it also comes with drawbacks. For example it creates overhead depending on the request.
88

99
API Platform creates a REST API by default. But you can choose to enable GraphQL as well.
1010

0 commit comments

Comments
 (0)