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
Show file tree
Hide file tree
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
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions core/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions core/content-negotiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand Down Expand Up @@ -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:
# ...
Expand All @@ -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' ]
Expand Down
12 changes: 6 additions & 6 deletions core/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,7 +106,7 @@ class Book
```

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

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

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

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get: ~
Expand Down Expand Up @@ -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']
Expand Down
6 changes: 3 additions & 3 deletions core/data-persisters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -229,7 +229,7 @@ final class BlogPostDataPersister implements ContextAwareDataPersisterInterface,
```

```yaml
# api/config/services.yaml
# config/services.yaml
services:
# ...
App\DataPersister\BlogPostDataPersister: ~
Expand Down
6 changes: 3 additions & 3 deletions core/data-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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': ~
Expand Down Expand Up @@ -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':
Expand Down
8 changes: 4 additions & 4 deletions core/default-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion core/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Review
```

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

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
resources:
App\Entity\Book:
attributes:
Expand Down Expand Up @@ -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': ~
Expand Down Expand Up @@ -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': ~
Expand Down Expand Up @@ -267,7 +267,7 @@ final class BookInputDataTransformer implements DataTransformerInterface
```

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

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

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
resources:
App\Entity\Book:
collectionOperations:
Expand Down
4 changes: 2 additions & 2 deletions core/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Book
```

```yaml
# api/config/api_platform/resources.yaml
# config/api_platform/resources.yaml
App\Entity\Book:
itemOperations:
get:
Expand Down
4 changes: 2 additions & 2 deletions core/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

# ...
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion core/file-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Loading