Skip to content

Commit 84a8a1a

Browse files
committed
merge
2 parents 72405e8 + 4131f41 commit 84a8a1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+705
-945
lines changed

admin/authentication-support.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Authentication can easily be handled when using the API Platform's admin library.
44
In the following section, we will assume [the API is secured using JWT](https://api-platform.com/docs/core/jwt), but the
5-
process is similar for other authentication mechanisms. The `login_uri` is the full URI to the route specified by the `firewalls.login.json_login.check_path` config in the [JWT documentation](https://api-platform.com/docs/core/jwt).
5+
process is similar for other authentication mechanisms. The `login_uri` is the full URI to the route specified by the `firewalls.login.json_login.check_path` config in the [JWT documentation](https://api-platform.com/docs/core/jwt).
66

77
The first step is to create a client to handle the authentication process:
88

@@ -11,7 +11,7 @@ The first step is to create a client to handle the authentication process:
1111
import { AUTH_LOGIN, AUTH_LOGOUT, AUTH_ERROR, AUTH_CHECK } from 'admin-on-rest';
1212

1313
// Change this to be your own login check route.
14-
const login_uri = 'https://demo.api-platform.com/login_check';
14+
const login_uri = 'https://demo.api-platform.com/login_check';
1515

1616
export default (type, params) => {
1717
switch (type) {
@@ -48,7 +48,7 @@ export default (type, params) => {
4848

4949
case AUTH_CHECK:
5050
return localStorage.getItem('token') ? Promise.resolve() : Promise.reject();
51-
51+
5252
default:
5353
return Promise.resolve();
5454
}
@@ -105,7 +105,3 @@ export default props => (
105105

106106
Refer to [the chapter dedicated to authentication in the Admin On Rest documentation](https://marmelab.com/admin-on-rest/Authentication.html)
107107
for more information.
108-
109-
Previous chapter: [Getting Started](getting-started.md)
110-
111-
Next chapter: [Handling Relations to Collections](handling-relations-to-collections.md)

admin/getting-started.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Then, create a new React application for your admin:
1212
$ create-react-app my-admin
1313

1414
React and React DOM will be directly provided as dependencies of Admin On REST. As having different versions of React
15-
causes issues, remove `react` and `react-dom` from the `dependencies` section of the generated `package.json` file:
15+
causes issues, remove `react` and `react-dom` from the `dependencies` section of the generated `package.json` file:
1616

1717
```patch
1818
- "react": "^15.6.1",
@@ -153,7 +153,7 @@ export default (props) => <HydraAdmin apiDocumentationParser={apiDocumentationPa
153153
__Note__: In this example, we choose to send the file via a multi-part form data, but you are totally free to use another solution (like `base64`). But keep in mind that multi-part form data is the most efficient solution.
154154

155155
### Using a Custom Validation Function or Inject Custom Props
156-
156+
157157
You can use `fieldProps` and `inputProps` to respectively inject custom properties to fields and inputs generated by API
158158
Platform Admin. This is particularly useful to add custom validation rules:
159159

@@ -186,7 +186,3 @@ export default class extends Component {
186186
}
187187
}
188188
```
189-
190-
Previous chapter: [Introduction](index.md)
191-
192-
Next chapter: [Authentication Support](authentication-support.md)

admin/handling-relations-to-collections.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This API can be created using the following PHP code:
1212

1313
```php
1414
<?php
15+
// src/AppBundle/Entity/Person.php
1516

1617
namespace App\Entity;
1718

@@ -40,6 +41,7 @@ class Person
4041

4142
```php
4243
<?php
44+
// src/AppBundle/Entity/Book.php
4345

4446
namespace App\Entity;
4547

@@ -128,7 +130,6 @@ Start by adding a "partial search" filter on the `name` property of the `Book` r
128130

129131
```yaml
130132
# config/api_filters.yml
131-
132133
services:
133134
person.search_filter:
134135
parent: 'api_platform.doctrine.orm.search_filter'
@@ -168,7 +169,3 @@ Then edit the configuration of API Platform Admin to pass a `filterToQuery` prop
168169
```
169170

170171
The autocomplete field should now work properly!
171-
172-
Previous chapter: [Authentication Support](authentication-support.md)
173-
174-
Next chapter: [Client Generator: Introduction](../client-generator/index.md)

admin/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@ You can also customize all screens by using Admin On Rest components and even ra
2525
* Send proper HTTP requests to the API and decode them using Hydra and JSON-LD formats
2626
* Nicely display server-side errors (e.g. advanced validation)
2727
* **100% customizable**
28-
29-
Previous chapter: [Schema Generator: configuration](../schema-generator/configuration.md)
30-
31-
Next chapter: [Getting Started](getting-started.md)

client-generator/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ The generator works especially well with APIs built with the [API Platform](http
2121
* The generated HTML is compatible with [Bootstrap](https://getbootstrap.com/) and includes mandatory classes
2222
* The generated HTML code is accessible to people with disabilities ([ARIA](https://www.w3.org/WAI/intro/aria) support)
2323
* The Redux and the React Router configuration is also generated
24-
25-
Previous chapter: [Admin: Handling Relations to Collections](../admin/handling-relations-to-collections.md)
26-
27-
Next chapter: [React generator](react.md)

client-generator/react.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Bootstrap 3 - last release 0.1.15
1919
```html
2020
<!-- ... -->
2121
<title>React App</title>
22-
22+
2323
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
2424
</head>
2525
<!-- ... -->
@@ -29,14 +29,13 @@ Bootstrap 4 - from release 0.1.16
2929
```html
3030
<!-- ... -->
3131
<title>React App</title>
32-
32+
3333
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
3434
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
3535
</head>
3636
<!-- ... -->
3737
```
3838

39-
4039
In the app directory, generate the files for the resource you want:
4140

4241
$ generate-api-platform-client https://demo.api-platform.com src/ --resource foo
@@ -82,7 +81,3 @@ ReactDom.render(
8281

8382
registerServiceWorker();
8483
```
85-
86-
Previous chapter: [Introduction](index.md)
87-
88-
Next chapter: [Vue.js generator](vuejs.md)

client-generator/troubleshooting.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* The generator does not perform any authentication, so you must ensure that all referenced Hydra paths for your API are
44
accessible anonymously. If you are using API Platform this will at least include:
55

6-
```
7-
api_entrypoint ANY ANY ANY /{index}.{_format}
8-
api_doc ANY ANY ANY /docs.{_format}
9-
api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format}
10-
```
6+
```
7+
api_entrypoint ANY ANY ANY /{index}.{_format}
8+
api_doc ANY ANY ANY /docs.{_format}
9+
api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format}
10+
```
1111

1212
* If you receive `Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist.` you may have
1313
specified the documentation URL instead of the entrypoint. For example if you are using API Platform and your
@@ -22,23 +22,19 @@ you are using by running something like `curl https://demo.api-platform.com/`.
2222

2323
* If you receive a message like this:
2424

25-
```
26-
{ Error
27-
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
28-
at <anonymous>
29-
at process._tickCallback (internal/process/next_tick.js:188:7)
30-
name: 'jsonld.InvalidUrl',
31-
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
32-
details:
33-
{ code: 'invalid remote context',
34-
url: 'https://demo.api-platform.com/contexts/Entrypoint',
35-
cause: null } }
36-
```
37-
38-
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check
39-
access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied"
40-
message in JSON format was being returned.
41-
42-
Previous chapter: [Vue.js generator](vuejs.md)
43-
44-
Next chapter: [Deployment: Introduction](../deployment/index.md)
25+
```
26+
{ Error
27+
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
28+
at <anonymous>
29+
at process._tickCallback (internal/process/next_tick.js:188:7)
30+
name: 'jsonld.InvalidUrl',
31+
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
32+
details:
33+
{ code: 'invalid remote context',
34+
url: 'https://demo.api-platform.com/contexts/Entrypoint',
35+
cause: null } }
36+
```
37+
38+
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check
39+
access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied"
40+
message in JSON format was being returned.

client-generator/vuejs.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Create a Vue.js application using [vue-cli](https://github.com/vuejs/vue-cli):
77

88
Install Vue Router, Vuex and babel-plugin-transform-builtin-extend (to allow extending bultin types like Error and Array):
99

10-
$ yarn add vue-router vuex babel-plugin-transform-builtin-extend babel-preset-es2015 babel-preset-stage-2
10+
$ yarn add vue-router vuex babel-plugin-transform-builtin-extend babel-preset-es2015 babel-preset-stage-2
1111

1212
Install the generator globally:
1313

@@ -100,6 +100,3 @@ Replace the `App.vue` file with the following :
100100
</div>
101101
</template>
102102
```
103-
Previous chapter: [React generator](react.md)
104-
105-
Next chapter: [Troubleshooting](troubleshooting.md)

core/angularjs-integration.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# AngularJS integration
1+
# AngularJS Integration
2+
3+
Warning: For new project, you should consider using [the API Platform's Progressive Web App generator](../client-generator/index.md)
4+
(that supports React and Vue.js) instead of this Angular v1 integration.
25

36
## Restangular
47

5-
ApiPlatformBundle works fine with [AngularJS v1](http://angularjs.org). The popular [Restangular](https://github.com/mgonto/restangular)
8+
API Platform works fine with [AngularJS v1](http://angularjs.org). The popular [Restangular](https://github.com/mgonto/restangular)
69
REST client library for Angular can easily be configured to handle the API format.
710

811
Here is a working Restangular config:
@@ -95,7 +98,3 @@ nga.configure(admin);
9598
```
9699

97100
You can look at what we have done as another exemple [api-platform/admin](https://github.com/api-platform/admin).
98-
99-
Previous chapter: [NelmioApiDocBundle integration](nelmio-api-doc.md)
100-
101-
Next chapter: [Swagger Support](swagger.md)

core/configuration.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Here's the complete configuration of the Symfony bundle with including default v
44

55
```yaml
66
# app/config/config.yml
7-
87
api_platform:
98

109
# The title of the API.
@@ -188,7 +187,3 @@ api_platform:
188187

189188
# ...
190189
```
191-
192-
Previous chapter: [Getting Started](getting-started.md)
193-
194-
Next chapter: [Operations](operations.md)

core/content-negotiation.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ and of a custom format called `myformat` and having `application/vnd.myformat` a
4242

4343
```yaml
4444
# app/config/config.yml
45-
4645
api_platform:
47-
4846
# ...
4947

5048
formats:
@@ -79,9 +77,7 @@ own implementation of `CustomItemNormalizer`:
7977

8078
```yaml
8179
# app/config/services.yml
82-
8380
services:
84-
8581
# ...
8682
8783
'AppBundle\Serializer\CustomItemNormalizer':
@@ -91,7 +87,6 @@ services:
9187

9288
```php
9389
<?php
94-
9590
// src/AppBundle/Serializer/CustomItemNormalizer.php
9691
9792
namespace AppBundle\Serializer;
@@ -139,7 +134,6 @@ flatten or remove too complex relations:
139134

140135
```php
141136
<?php
142-
143137
// src/AppBundle/Serializer/CustomItemNormalizer.php
144138
145139
namespace AppBundle\Serializer;
@@ -167,11 +161,7 @@ class CustomItemNormalizer implements NormalizerInterface, DenormalizerInterface
167161
168162
return $result;
169163
}
170-
164+
171165
// ...
172166
}
173167
```
174-
175-
Previous chapter: [The Event System](events.md)
176-
177-
Next chapter: [Using External JSON-LD Vocabularies](external-vocabularies.md)

core/data-providers.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Both implementations can also implement a third, optional interface called
2222
if you want to limit their effects to a single resource or operation.
2323

2424
In the following examples we will create custom data providers for an entity class called `AppBundle\Entity\BlogPost`.
25-
Note, that if your entity is not Doctrine-related, you need to flag the identifier property by using `@ApiProperty(identifier=true)` for things to work properly (see also [Entity Identifier Case](serialization-groups-and-relations.md#entity-identifier-case)).
25+
Note, that if your entity is not Doctrine-related, you need to flag the identifier property by using `@ApiProperty(identifier=true)` for things to work properly (see also [Entity Identifier Case](serialization.md#entity-identifier-case)).
2626

2727
## Custom Collection Data Provider
2828

@@ -33,7 +33,6 @@ If no data is available, you should return an empty array.
3333

3434
```php
3535
<?php
36-
3736
// src/AppBundle/DataProvider/BlogPostCollectionDataProvider.php
3837

3938
namespace AppBundle\DataProvider;
@@ -83,7 +82,6 @@ The `getItem` method can return `null` if no result has been found.
8382

8483
```php
8584
<?php
86-
8785
// src/AppBundle/DataProvider/BlogPostItemDataProvider.php
8886
8987
namespace AppBundle\DataProvider;
@@ -110,8 +108,8 @@ final class BlogPostItemDataProvider implements ItemDataProviderInterface, Restr
110108

111109
If service autowiring and autoconfiguration are enabled (it's the case by default), you are done!
112110

113-
Otherwise, if you use a custom dependency injection configuration, you need to register the corresponding service add the
114-
`api_platform.item_data_provider` tag. As for collection data providers, the `priority` attribute can be used to order
111+
Otherwise, if you use a custom dependency injection configuration, you need to register the corresponding service and add the
112+
`api_platform.item_data_provider` tag to it. As for collection data providers, the `priority` attribute can be used to order
115113
providers.
116114

117115
```yaml
@@ -163,7 +161,3 @@ final class BlogPostItemDataProvider implements ItemDataProviderInterface, Seria
163161
}
164162
}
165163
```
166-
167-
Previous chapter: [Extending JSON-LD context](extending-jsonld-context.md)
168-
169-
Next chapter: [Extensions](extensions.md)

core/default-order.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ customize this order, you must add an `order` attribute on your ApiResource anno
77

88
```php
99
<?php
10-
1110
// src/AppBundle/Entity/Book.php
1211

1312
namespace AppBundle\Entity;
@@ -33,7 +32,6 @@ If you only specify the key, `ASC` direction will be used as default. For exampl
3332

3433
```php
3534
<?php
36-
3735
// src/AppBundle/Entity/Book.php
3836

3937
namespace AppBundle\Entity;
@@ -61,8 +59,8 @@ class Book
6159

6260
It's also possible to configure the default filter on an association property:
6361

62+
```php
6463
<?php
65-
6664
// src/AppBundle/Entity/Book.php
6765

6866
namespace AppBundle\Entity;
@@ -81,7 +79,4 @@ class Book
8179
*/
8280
public $author;
8381
}
84-
85-
Previous chapter: [Operations](operations.md)
86-
87-
Next chapter: [Filters](filters.md)
82+
```

core/events.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ In the following example, we will send a mail each time a new book is created us
1616

1717
```php
1818
<?php
19-
2019
// src/AppBundle/EventSubscriber/BookMailSubscriber.php
2120

2221
namespace AppBundle\EventSubscriber;
@@ -105,7 +104,3 @@ Constant | Event | Priority |
105104
`POST_WRITE` | `kernel.view` | 31 |
106105
`PRE_RESPOND` | `kernel.view` | 9 |
107106
`POST_RESPOND` | `kernel.response` | 0 |
108-
109-
Previous chapter: [Pagination](pagination.md)
110-
111-
Next chapter: [Content Negotiation](content-negotiation.md)

0 commit comments

Comments
 (0)