Skip to content

chore: merge 3.1 #1724

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 18 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
76 changes: 38 additions & 38 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,46 @@ name: Deploy Website
on:
push:
branches:
- main
- '*.*'
- main
- '*.*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:

- name: Checkout the website
uses: actions/checkout@v2
with:
repository: api-platform/website
ref: main

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install deps
run: yarn install

- name: Retrieve docs
run: bin/retrieve-documentation

- name: Build website
env:
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
run: yarn gatsby build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: api-platform.com
- name: Checkout the website
uses: actions/checkout@v3
with:
repository: api-platform/website
ref: main

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install deps
run: yarn install

- name: Retrieve docs
run: bin/retrieve-documentation

- name: Build website
env:
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
NODE_OPTIONS: --openssl-legacy-provider
run: yarn gatsby build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: api-platform.com
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -24,7 +24,7 @@ jobs:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
Expand Down
96 changes: 49 additions & 47 deletions core/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
#[AsController]
class CreateBookPublication extends AbstractController
{
private $bookPublishingHandler;

public function __construct(BookPublishingHandler $bookPublishingHandler)
{
$this->bookPublishingHandler = $bookPublishingHandler;
}
public function __construct(
private BookPublishingHandler $bookPublishingHandler
) {}

public function __invoke(Book $book): Book
{
Expand Down Expand Up @@ -117,14 +114,15 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
method: POST
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
method: POST
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
```

```xml
Expand Down Expand Up @@ -188,14 +186,15 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
method: POST
uriTemplate: /books/{id}/publication
controller: ApiPlatform\Action\PlaceholderAction
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
method: POST
uriTemplate: /books/{id}/publication
controller: ApiPlatform\Action\PlaceholderAction
```

```xml
Expand Down Expand Up @@ -258,15 +257,16 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Get
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
normalizationContext:
groups: ['publication']
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Get
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
normalizationContext:
groups: ['publication']
```

```xml
Expand Down Expand Up @@ -329,14 +329,15 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
read: false
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
uriTemplate: /books/{id}/publication
controller: App\Controller\CreateBookPublication
read: false
```

```xml
Expand Down Expand Up @@ -401,14 +402,15 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
routeName: book_post_publication
book_post_discontinuation:
class: ApiPlatform\Metadata\Post
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get: ~
post_publication:
class: ApiPlatform\Metadata\Post
routeName: book_post_publication
book_post_discontinuation:
class: ApiPlatform\Metadata\Post
```

```xml
Expand Down
11 changes: 6 additions & 5 deletions core/dto.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ class Book {}
```
```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Post:
output: App\Dto\AnotherRepresentation
processor: App\State\BookRepresentationProcessor
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Post:
output: App\Dto\AnotherRepresentation
processor: App\State\BookRepresentationProcessor
```
```xml
<?xml version="1.0" encoding="UTF-8" ?>
Expand Down
9 changes: 5 additions & 4 deletions core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ class Book

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get:
hydraContext: { foo: 'bar' }
resources:
App\Entity\Book:
operations:
ApiPlatform\Metadata\Get:
hydraContext: { foo: 'bar' }
```

```xml
Expand Down
13 changes: 7 additions & 6 deletions core/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ to a Resource in two ways:

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Offer:
operations:
ApiPlatform\Metadata\GetCollection:
filters: ['offer.date_filter']
# ...
resources:
App\Entity\Offer:
operations:
ApiPlatform\Metadata\GetCollection:
filters: ['offer.date_filter']
# ...
```

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

```php
<?php
// api/Annotation/UserAware.php
// api/src/Attribute/UserAware.php

namespace App\Attribute;

Expand Down
Loading