Skip to content

fix: path references in YAML config snippets #2123

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

Open
wants to merge 1 commit into
base: 2.6
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion admin/getting-started.md
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ export default () => (
Be sure to make your API send proper [CORS HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) to allow
the admin's domain to access it.

To do so, if you use the API Platform Distribution, update the value of the `CORS_ALLOW_ORIGIN` parameter in `api/.env` (it will be set to `^https?://localhost:?[0-9]*$`
To do so, if you use the API Platform Distribution, update the value of the `CORS_ALLOW_ORIGIN` parameter in `.env` (it will be set to `^https?://localhost:?[0-9]*$`
by default).

If you use a custom installation of Symfony and [API Platform Core](../core/), you will need to adjust the [NelmioCorsBundle configuration](https://github.com/nelmio/NelmioCorsBundle#configuration) to expose the `Link` HTTP header and to send proper CORS headers on the route under which the API will be served (`/api` by default).
4 changes: 2 additions & 2 deletions core/configuration.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
Here's the complete configuration of the Symfony bundle including default values:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:

# The title of the API.
@@ -322,7 +322,7 @@ api_platform:
If you need to globally configure all the resources instead of adding configuration in each one, it's possible to do so with the `defaults` key:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:

defaults:
10 changes: 5 additions & 5 deletions core/content-negotiation.md
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ The first required step is to configure allowed formats. The following configura
and of a custom format called `myformat` and having `application/vnd.myformat` as [MIME type](https://en.wikipedia.org/wiki/Media_type).

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:
formats:
jsonld: ['application/ld+json']
@@ -68,7 +68,7 @@ Support for the JSON:API PATCH format is automatically enabled if JSON:API suppo
JSON Merge Patch support must be enabled explicitly:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:
patch_formats:
json: ['application/merge-patch+json']
@@ -84,7 +84,7 @@ API Platform will try to send to the client the error format matching with the f
Available formats can also be configured:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:
error_formats:
jsonproblem: ['application/problem+json']
@@ -197,7 +197,7 @@ Refer to the Symfony documentation to learn [how to create and register such cla
Then, register the new format in the configuration:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
api_platform:
formats:
# ...
@@ -214,7 +214,7 @@ Using composition is the recommended way to implement a custom normalizer. You c
own implementation of `CustomItemNormalizer`:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
'App\Serializer\CustomItemNormalizer':
arguments: [ '@api_platform.serializer.normalizer.item' ]
12 changes: 6 additions & 6 deletions core/controllers.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ implements the [Action-Domain-Responder](https://github.com/pmjones/adr) pattern
[MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller).

The distribution of API Platform also eases the implementation of the ADR pattern: it automatically registers action classes
stored in `api/src/Controller` as autowired services.
stored in `src/Controller` as autowired services.

Thanks to the [autowiring](http://symfony.com/doc/current/components/dependency_injection/autowiring.html) feature of the
Symfony Dependency Injection container, services required by an action can be type-hinted in its constructor, it will be
@@ -106,7 +106,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get: ~
@@ -178,7 +178,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get: ~
@@ -248,7 +248,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get: ~
@@ -321,7 +321,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get: ~
@@ -418,7 +418,7 @@ class BookController extends AbstractController
```

```yaml
# api/config/routes.yaml
# config/routes.yaml
book_post_publication:
path: /books/{id}/publication
methods: ['POST']
6 changes: 3 additions & 3 deletions core/data-persisters.md
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ Otherwise, if you use a custom dependency injection configuration, you need to r
`api_platform.data_persister` tag. The `priority` attribute can be used to order persisters.

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
App\DataPersister\BlogPostDataPersister: ~
@@ -138,7 +138,7 @@ final class UserDataPersister implements ContextAwareDataPersisterInterface
Even with service autowiring and autoconfiguration enabled, you must still configure the decoration:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
App\DataPersister\UserDataPersister:
@@ -229,7 +229,7 @@ final class BlogPostDataPersister implements ContextAwareDataPersisterInterface,
```

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
App\DataPersister\BlogPostDataPersister: ~
6 changes: 3 additions & 3 deletions core/data-providers.md
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ If you use the default configuration, the corresponding service will be automati
To declare the service explicitly, or to set a custom priority, you can use the following snippet:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataProvider\BlogPostCollectionDataProvider':
@@ -118,7 +118,7 @@ Otherwise, if you use a custom dependency injection configuration, you need to r
providers.

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataProvider\BlogPostItemDataProvider': ~
@@ -163,7 +163,7 @@ final class BlogPostSubresourceDataProvider implements SubresourceDataProviderIn
Declare the service in your services configuration:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataProvider\BlogPostSubresourceDataProvider':
8 changes: 4 additions & 4 deletions core/default-order.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ class Book
```

```yaml
# api/config/api_platform/resources/Book.yaml
# config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order:
@@ -70,7 +70,7 @@ class Book
```

```yaml
# api/config/api_platform/resources/Book.yaml
# config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order: ['foo', 'bar']
@@ -104,7 +104,7 @@ class Book
```

```yaml
# api/config/api_platform/resources/Book.yaml
# config/api_platform/resources/Book.yaml
App\Entity\Book:
attributes:
order: ['author.username']
@@ -146,7 +146,7 @@ class Book
```

```yaml
# api/config/api_platform/resources/Book.yaml
# config/api_platform/resources/Book.yaml
App\Entity\Book:
get: ~
get_desc_custom:
2 changes: 1 addition & 1 deletion core/deprecations.md
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ class Review
```

```yaml
# api/config/api_platform/resources/Review.yaml
# config/api_platform/resources/Review.yaml
resources:
# ...
App\Entity\Review:
12 changes: 6 additions & 6 deletions core/dto.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ final class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
resources:
App\Entity\Book:
attributes:
@@ -129,7 +129,7 @@ final class BookInputDataTransformer implements DataTransformerInterface
We now register it:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataTransformer\BookInputDataTransformer': ~
@@ -192,7 +192,7 @@ final class BookOutputDataTransformer implements DataTransformerInterface
We now register it:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataTransformer\BookOutputDataTransformer': ~
@@ -267,7 +267,7 @@ final class BookInputDataTransformer implements DataTransformerInterface
```

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataTransformer\BookInputDataTransformer': ~
@@ -340,7 +340,7 @@ final class BookInputDataTransformerInitializer implements DataTransformerInitia
Register it:

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
'App\DataTransformer\BookInputDataTransformerInitializer': ~
@@ -392,7 +392,7 @@ final class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
resources:
App\Entity\Book:
collectionOperations:
4 changes: 2 additions & 2 deletions core/elasticsearch.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ composer require elasticsearch/elasticsearch:^6.0
Then, enable it inside the API Platform configuration:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
parameters:
# ...
env(ELASTICSEARCH_HOST): 'http://localhost:9200'
@@ -210,7 +210,7 @@ For example, consider an index being similar to a database in an SQL database an
So the `User` and `Tweet` resources of the previous example would become `user` and `tweet` types in an index named `app`:

```yaml
# api/config/packages/api_platform.yaml
# config/packages/api_platform.yaml
parameters:
# ...
env(ELASTICSEARCH_HOST): 'http://localhost:9200'
2 changes: 1 addition & 1 deletion core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get:
4 changes: 2 additions & 2 deletions core/extensions.md
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ final class CurrentUserExtension implements QueryCollectionExtensionInterface, Q
Finally, if you're not using the autoconfiguration, you have to register the custom extension with either of those tags:

```yaml
# api/config/services.yaml
# config/services.yaml
services:

# ...
@@ -134,7 +134,7 @@ This example adds a `WHERE` clause condition only when a fully authenticated use
To secure the access to endpoints, use the following access control rule:

```yaml
# app/config/package/security.yaml
# config/package/security.yaml
security:
# ...
access_control:
2 changes: 1 addition & 1 deletion core/file-upload.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ This will create a new configuration file that you will need to slightly change
to make it look like this.

```yaml
# api/config/packages/vich_uploader.yaml
# config/packages/vich_uploader.yaml
vich_uploader:
db_driver: orm

Loading