Skip to content

Commit 752eff3

Browse files
authored
Merge pull request #1724 from alanpoulain/chore/merge-3.1
chore: merge 3.1
2 parents bb2cdcd + 8bd5171 commit 752eff3

31 files changed

+471
-805
lines changed

.github/workflows/cd.yml

+38-38
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,46 @@ name: Deploy Website
33
on:
44
push:
55
branches:
6-
- main
7-
- '*.*'
6+
- main
7+
- '*.*'
88

99
jobs:
1010
deploy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
14-
- name: Checkout the website
15-
uses: actions/checkout@v2
16-
with:
17-
repository: api-platform/website
18-
ref: main
19-
20-
- name: Get yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
23-
24-
- uses: actions/cache@v2
25-
id: yarn-cache
26-
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-yarn-
31-
32-
- name: Install deps
33-
run: yarn install
34-
35-
- name: Retrieve docs
36-
run: bin/retrieve-documentation
37-
38-
- name: Build website
39-
env:
40-
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
41-
run: yarn gatsby build
42-
43-
- name: Deploy
44-
uses: peaceiris/actions-gh-pages@v3
45-
with:
46-
github_token: ${{ secrets.GITHUB_TOKEN }}
47-
publish_dir: ./public
48-
cname: api-platform.com
13+
- name: Checkout the website
14+
uses: actions/checkout@v3
15+
with:
16+
repository: api-platform/website
17+
ref: main
18+
19+
- name: Get yarn cache directory path
20+
id: yarn-cache-dir-path
21+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
22+
23+
- uses: actions/cache@v3
24+
id: yarn-cache
25+
with:
26+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
27+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-yarn-
30+
31+
- name: Install deps
32+
run: yarn install
33+
34+
- name: Retrieve docs
35+
run: bin/retrieve-documentation
36+
37+
- name: Build website
38+
env:
39+
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
40+
NODE_OPTIONS: --openssl-legacy-provider
41+
run: yarn gatsby build
42+
43+
- name: Deploy
44+
uses: peaceiris/actions-gh-pages@v3
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
publish_dir: ./public
48+
cname: api-platform.com

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0
1717

@@ -24,7 +24,7 @@ jobs:
2424
DEFAULT_BRANCH: main
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626

27-
- uses: actions/cache@v2
27+
- uses: actions/cache@v3
2828
with:
2929
path: ~/.cache/pip
3030
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

core/controllers.md

+49-47
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
4444
#[AsController]
4545
class CreateBookPublication extends AbstractController
4646
{
47-
private $bookPublishingHandler;
48-
49-
public function __construct(BookPublishingHandler $bookPublishingHandler)
50-
{
51-
$this->bookPublishingHandler = $bookPublishingHandler;
52-
}
47+
public function __construct(
48+
private BookPublishingHandler $bookPublishingHandler
49+
) {}
5350

5451
public function __invoke(Book $book): Book
5552
{
@@ -117,14 +114,15 @@ class Book
117114

118115
```yaml
119116
# api/config/api_platform/resources.yaml
120-
App\Entity\Book:
121-
operations:
122-
ApiPlatform\Metadata\Get: ~
123-
post_publication:
124-
class: ApiPlatform\Metadata\Post
125-
method: POST
126-
uriTemplate: /books/{id}/publication
127-
controller: App\Controller\CreateBookPublication
117+
resources:
118+
App\Entity\Book:
119+
operations:
120+
ApiPlatform\Metadata\Get: ~
121+
post_publication:
122+
class: ApiPlatform\Metadata\Post
123+
method: POST
124+
uriTemplate: /books/{id}/publication
125+
controller: App\Controller\CreateBookPublication
128126
```
129127
130128
```xml
@@ -188,14 +186,15 @@ class Book
188186

189187
```yaml
190188
# api/config/api_platform/resources.yaml
191-
App\Entity\Book:
192-
operations:
193-
ApiPlatform\Metadata\Get: ~
194-
post_publication:
195-
class: ApiPlatform\Metadata\Post
196-
method: POST
197-
uriTemplate: /books/{id}/publication
198-
controller: ApiPlatform\Action\PlaceholderAction
189+
resources:
190+
App\Entity\Book:
191+
operations:
192+
ApiPlatform\Metadata\Get: ~
193+
post_publication:
194+
class: ApiPlatform\Metadata\Post
195+
method: POST
196+
uriTemplate: /books/{id}/publication
197+
controller: ApiPlatform\Action\PlaceholderAction
199198
```
200199
201200
```xml
@@ -258,15 +257,16 @@ class Book
258257

259258
```yaml
260259
# api/config/api_platform/resources.yaml
261-
App\Entity\Book:
262-
operations:
263-
ApiPlatform\Metadata\Get: ~
264-
post_publication:
265-
class: ApiPlatform\Metadata\Get
266-
uriTemplate: /books/{id}/publication
267-
controller: App\Controller\CreateBookPublication
268-
normalizationContext:
269-
groups: ['publication']
260+
resources:
261+
App\Entity\Book:
262+
operations:
263+
ApiPlatform\Metadata\Get: ~
264+
post_publication:
265+
class: ApiPlatform\Metadata\Get
266+
uriTemplate: /books/{id}/publication
267+
controller: App\Controller\CreateBookPublication
268+
normalizationContext:
269+
groups: ['publication']
270270
```
271271
272272
```xml
@@ -329,14 +329,15 @@ class Book
329329

330330
```yaml
331331
# api/config/api_platform/resources.yaml
332-
App\Entity\Book:
333-
operations:
334-
ApiPlatform\Metadata\Get: ~
335-
post_publication:
336-
class: ApiPlatform\Metadata\Post
337-
uriTemplate: /books/{id}/publication
338-
controller: App\Controller\CreateBookPublication
339-
read: false
332+
resources:
333+
App\Entity\Book:
334+
operations:
335+
ApiPlatform\Metadata\Get: ~
336+
post_publication:
337+
class: ApiPlatform\Metadata\Post
338+
uriTemplate: /books/{id}/publication
339+
controller: App\Controller\CreateBookPublication
340+
read: false
340341
```
341342
342343
```xml
@@ -401,14 +402,15 @@ class Book
401402

402403
```yaml
403404
# api/config/api_platform/resources.yaml
404-
App\Entity\Book:
405-
operations:
406-
ApiPlatform\Metadata\Get: ~
407-
post_publication:
408-
class: ApiPlatform\Metadata\Post
409-
routeName: book_post_publication
410-
book_post_discontinuation:
411-
class: ApiPlatform\Metadata\Post
405+
resources:
406+
App\Entity\Book:
407+
operations:
408+
ApiPlatform\Metadata\Get: ~
409+
post_publication:
410+
class: ApiPlatform\Metadata\Post
411+
routeName: book_post_publication
412+
book_post_discontinuation:
413+
class: ApiPlatform\Metadata\Post
412414
```
413415
414416
```xml

core/dto.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ class Book {}
140140
```
141141
```yaml
142142
# api/config/api_platform/resources.yaml
143-
App\Entity\Book:
144-
operations:
145-
ApiPlatform\Metadata\Post:
146-
output: App\Dto\AnotherRepresentation
147-
processor: App\State\BookRepresentationProcessor
143+
resources:
144+
App\Entity\Book:
145+
operations:
146+
ApiPlatform\Metadata\Post:
147+
output: App\Dto\AnotherRepresentation
148+
processor: App\State\BookRepresentationProcessor
148149
```
149150
```xml
150151
<?xml version="1.0" encoding="UTF-8" ?>

core/extending-jsonld-context.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ class Book
8888

8989
```yaml
9090
# api/config/api_platform/resources.yaml
91-
App\Entity\Book:
92-
operations:
93-
ApiPlatform\Metadata\Get:
94-
hydraContext: { foo: 'bar' }
91+
resources:
92+
App\Entity\Book:
93+
operations:
94+
ApiPlatform\Metadata\Get:
95+
hydraContext: { foo: 'bar' }
9596
```
9697
9798
```xml

core/filters.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ to a Resource in two ways:
7171

7272
```yaml
7373
# api/config/api_platform/resources.yaml
74-
App\Entity\Offer:
75-
operations:
76-
ApiPlatform\Metadata\GetCollection:
77-
filters: ['offer.date_filter']
78-
# ...
74+
resources:
75+
App\Entity\Offer:
76+
operations:
77+
ApiPlatform\Metadata\GetCollection:
78+
filters: ['offer.date_filter']
79+
# ...
7980
```
8081

8182
```xml
@@ -1461,7 +1462,7 @@ Start by creating a custom attribute to mark restricted entities:
14611462

14621463
```php
14631464
<?php
1464-
// api/Annotation/UserAware.php
1465+
// api/src/Attribute/UserAware.php
14651466
14661467
namespace App\Attribute;
14671468

0 commit comments

Comments
 (0)