Skip to content

Commit 8a00fdb

Browse files
authored
docs: remove indentation to fix faulty code blocks (#1810)
1 parent 1de48f9 commit 8a00fdb

File tree

3 files changed

+155
-155
lines changed

3 files changed

+155
-155
lines changed

core/filters.md

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -23,112 +23,112 @@ to a Resource in two ways:
2323

2424
1. Through the resource declaration, as the `filters` attribute.
2525

26-
For example, having a filter service declaration in `services.yaml`:
26+
For example, having a filter service declaration in `services.yaml`:
2727

28-
```yaml
29-
# api/config/services.yaml
30-
services:
28+
```yaml
29+
# api/config/services.yaml
30+
services:
31+
# ...
32+
offer.date_filter:
33+
parent: 'api_platform.doctrine.orm.date_filter'
34+
arguments: [ { dateProperty: ~ } ]
35+
tags: [ 'api_platform.filter' ]
36+
# The following are mandatory only if a _defaults section is defined with inverted values.
37+
# You may want to isolate filters in a dedicated file to avoid adding the following lines.
38+
autowire: false
39+
autoconfigure: false
40+
public: false
41+
```
42+
43+
Alternatively, you can choose to use a dedicated file to gather filters together:
44+
45+
```yaml
46+
# api/config/filters.yaml
47+
services:
48+
offer.date_filter:
49+
parent: 'api_platform.doctrine.orm.date_filter'
50+
arguments: [ { dateProperty: ~ } ]
51+
tags: [ 'api_platform.filter' ]
52+
```
53+
54+
We're linking the filter `offer.date_filter` with the resource like this:
55+
56+
[codeSelector]
57+
58+
```php
59+
<?php
60+
// api/src/Entity/Offer.php
61+
namespace App\Entity;
62+
63+
use ApiPlatform\Metadata\ApiResource;
64+
65+
#[ApiResource(filters: ['offer.date_filter'])]
66+
class Offer
67+
{
68+
// ...
69+
}
70+
```
71+
72+
```yaml
73+
# api/config/api_platform/resources.yaml
74+
resources:
75+
App\Entity\Offer:
76+
operations:
77+
ApiPlatform\Metadata\GetCollection:
78+
filters: ['offer.date_filter']
3179
# ...
32-
offer.date_filter:
33-
parent: 'api_platform.doctrine.orm.date_filter'
34-
arguments: [ { dateProperty: ~ } ]
35-
tags: [ 'api_platform.filter' ]
36-
# The following are mandatory only if a _defaults section is defined with inverted values.
37-
# You may want to isolate filters in a dedicated file to avoid adding the following lines.
38-
autowire: false
39-
autoconfigure: false
40-
public: false
41-
```
42-
43-
Alternatively, you can choose to use a dedicated file to gather filters together:
44-
45-
```yaml
46-
# api/config/filters.yaml
47-
services:
48-
offer.date_filter:
49-
parent: 'api_platform.doctrine.orm.date_filter'
50-
arguments: [ { dateProperty: ~ } ]
51-
tags: [ 'api_platform.filter' ]
52-
```
53-
54-
We're linking the filter `offer.date_filter` with the resource like this:
55-
56-
[codeSelector]
57-
58-
```php
59-
<?php
60-
// api/src/Entity/Offer.php
61-
namespace App\Entity;
62-
63-
use ApiPlatform\Metadata\ApiResource;
64-
65-
#[ApiResource(filters: ['offer.date_filter'])]
66-
class Offer
67-
{
68-
// ...
69-
}
70-
```
71-
72-
```yaml
73-
# api/config/api_platform/resources.yaml
74-
resources:
75-
App\Entity\Offer:
76-
operations:
77-
ApiPlatform\Metadata\GetCollection:
78-
filters: ['offer.date_filter']
79-
# ...
80-
```
81-
82-
```xml
83-
<?xml version="1.0" encoding="UTF-8" ?>
84-
<!-- api/config/api_platform/resources.xml -->
85-
86-
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
87-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
88-
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
89-
https://api-platform.com/schema/metadata/resources-3.0.xsd">
90-
<resource class="App\Entity\Offer">
91-
<operations>
92-
<operation class="ApiPlatform\Metadata\GetCollection">
93-
<filters>
94-
<filter>offer.date_filter</filter>
95-
</filters>
96-
</operation>
97-
<!-- ... -->
98-
</operations>
99-
</resource>
100-
</resources>
101-
```
102-
103-
[/codeSelector]
80+
```
81+
82+
```xml
83+
<?xml version="1.0" encoding="UTF-8" ?>
84+
<!-- api/config/api_platform/resources.xml -->
85+
86+
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
87+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
88+
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
89+
https://api-platform.com/schema/metadata/resources-3.0.xsd">
90+
<resource class="App\Entity\Offer">
91+
<operations>
92+
<operation class="ApiPlatform\Metadata\GetCollection">
93+
<filters>
94+
<filter>offer.date_filter</filter>
95+
</filters>
96+
</operation>
97+
<!-- ... -->
98+
</operations>
99+
</resource>
100+
</resources>
101+
```
102+
103+
[/codeSelector]
104104

105105
2. By using the `#[ApiFilter]` attribute.
106106

107-
This attribute automatically declares the service, and you just have to use the filter class you want:
107+
This attribute automatically declares the service, and you just have to use the filter class you want:
108108

109-
```php
110-
<?php
111-
// api/src/Entity/Offer.php
112-
namespace App\Entity;
109+
```php
110+
<?php
111+
// api/src/Entity/Offer.php
112+
namespace App\Entity;
113113
114-
use ApiPlatform\Metadata\ApiFilter;
115-
use ApiPlatform\Metadata\ApiResource;
116-
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
114+
use ApiPlatform\Metadata\ApiFilter;
115+
use ApiPlatform\Metadata\ApiResource;
116+
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
117117
118-
#[ApiResource]
119-
#[ApiFilter(DateFilter::class, properties: ['dateProperty'])]
120-
class Offer
121-
{
122-
// ...
123-
}
124-
```
118+
#[ApiResource]
119+
#[ApiFilter(DateFilter::class, properties: ['dateProperty'])]
120+
class Offer
121+
{
122+
// ...
123+
}
124+
```
125125

126-
Learn more on how the [ApiFilter attribute](filters.md#apifilter-attribute) works.
126+
Learn more on how the [ApiFilter attribute](filters.md#apifilter-attribute) works.
127127

128-
For the sake of consistency, we're using the attribute in the below documentation.
128+
For the sake of consistency, we're using the attribute in the below documentation.
129129

130-
For MongoDB ODM, all the filters are in the namespace `ApiPlatform\Doctrine\Odm\Filter`. The filter
131-
services all begin with `api_platform.doctrine_mongodb.odm`.
130+
For MongoDB ODM, all the filters are in the namespace `ApiPlatform\Doctrine\Odm\Filter`. The filter
131+
services all begin with `api_platform.doctrine_mongodb.odm`.
132132

133133
### Search Filter
134134

core/pagination.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -410,45 +410,45 @@ The [PaginationExtension](https://github.com/api-platform/core/blob/main/src/Doc
410410

411411
* `$fetchJoinCollection` argument: Whether there is a join to a collection-valued association. When set to `true`, the Doctrine ORM Paginator will perform an additional query, in order to get the correct number of results.
412412

413-
You can configure this using the `paginationFetchJoinCollection` attribute on a resource or on a per-operation basis:
413+
You can configure this using the `paginationFetchJoinCollection` attribute on a resource or on a per-operation basis:
414414

415-
```php
416-
<?php
417-
// api/src/Entity/Book.php
418-
namespace App\Entity;
415+
```php
416+
<?php
417+
// api/src/Entity/Book.php
418+
namespace App\Entity;
419419
420-
use ApiPlatform\Metadata\ApiResource;
421-
use ApiPlatform\Metadata\GetCollection;
420+
use ApiPlatform\Metadata\ApiResource;
421+
use ApiPlatform\Metadata\GetCollection;
422422
423-
#[ApiResource(paginationFetchJoinCollection: false)]
424-
#[GetCollection]
425-
#[GetCollection(name: 'get_custom', paginationFetchJoinCollection: true)]
426-
class Book
427-
{
428-
// ...
429-
}
430-
```
423+
#[ApiResource(paginationFetchJoinCollection: false)]
424+
#[GetCollection]
425+
#[GetCollection(name: 'get_custom', paginationFetchJoinCollection: true)]
426+
class Book
427+
{
428+
// ...
429+
}
430+
```
431431

432432
* `setUseOutputWalkers` setter: Whether to use output walkers. When set to `true`, the Doctrine ORM Paginator will use output walkers, which are compulsory for some types of queries.
433433

434-
You can configure this using the `paginationUseOutputWalkers` attribute on a resource or on a per-operation basis:
434+
You can configure this using the `paginationUseOutputWalkers` attribute on a resource or on a per-operation basis:
435435

436-
```php
437-
<?php
438-
// api/src/Entity/Book.php
439-
namespace App\Entity;
436+
```php
437+
<?php
438+
// api/src/Entity/Book.php
439+
namespace App\Entity;
440440
441-
use ApiPlatform\Metadata\ApiResource;
442-
use ApiPlatform\Metadata\GetCollection;
441+
use ApiPlatform\Metadata\ApiResource;
442+
use ApiPlatform\Metadata\GetCollection;
443443
444-
#[ApiResource(paginationUseOutputWalkers: false)]
445-
#[GetCollection]
446-
#[GetCollection(name: 'get_custom', paginationUseOutputWalkers: true)]
447-
class Book
448-
{
449-
// ...
450-
}
451-
```
444+
#[ApiResource(paginationUseOutputWalkers: false)]
445+
#[GetCollection]
446+
#[GetCollection(name: 'get_custom', paginationUseOutputWalkers: true)]
447+
class Book
448+
{
449+
// ...
450+
}
451+
```
452452

453453
For more information, please see the [Pagination](https://www.doctrine-project.org/projects/doctrine-orm/en/current/tutorials/pagination.html) entry in the Doctrine ORM documentation.
454454

core/performance.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -357,46 +357,46 @@ To configure Blackfire.io follow these simple steps:
357357

358358
1. Add the following to your `docker-compose.override.yml` file:
359359

360-
```yaml
361-
blackfire:
362-
image: blackfire/blackfire:2
363-
environment:
364-
# Exposes the host BLACKFIRE_SERVER_ID and TOKEN environment variables.
365-
- BLACKFIRE_SERVER_ID
366-
- BLACKFIRE_SERVER_TOKEN
367-
- BLACKFIRE_DISABLE_LEGACY_PORT=1
368-
```
360+
```yaml
361+
blackfire:
362+
image: blackfire/blackfire:2
363+
environment:
364+
# Exposes the host BLACKFIRE_SERVER_ID and TOKEN environment variables.
365+
- BLACKFIRE_SERVER_ID
366+
- BLACKFIRE_SERVER_TOKEN
367+
- BLACKFIRE_DISABLE_LEGACY_PORT=1
368+
```
369369

370370
2. Add your Blackfire.io ID and server token to your `.env` file at the root of your project (be sure not to commit this to a public repository):
371371

372-
```shell
373-
BLACKFIRE_SERVER_ID=xxxxxxxxxx
374-
BLACKFIRE_SERVER_TOKEN=xxxxxxxxxx
375-
```
372+
```shell
373+
BLACKFIRE_SERVER_ID=xxxxxxxxxx
374+
BLACKFIRE_SERVER_TOKEN=xxxxxxxxxx
375+
```
376376

377-
Or set it in the console before running Docker commands:
377+
Or set it in the console before running Docker commands:
378378

379-
```shell
380-
export BLACKFIRE_SERVER_ID=xxxxxxxxxx
381-
export BLACKFIRE_SERVER_TOKEN=xxxxxxxxxx
382-
```
379+
```shell
380+
export BLACKFIRE_SERVER_ID=xxxxxxxxxx
381+
export BLACKFIRE_SERVER_TOKEN=xxxxxxxxxx
382+
```
383383

384384
3. Install and configure the Blackfire probe in the app container, by adding the following to your `./Dockerfile`:
385385

386-
```dockerfile
387-
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
388-
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \
389-
&& mkdir -p /tmp/blackfire \
390-
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
391-
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
392-
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini
393-
```
386+
```dockerfile
387+
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
388+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \
389+
&& mkdir -p /tmp/blackfire \
390+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
391+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
392+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini
393+
```
394394

395395
4. Rebuild and restart all your containers
396396

397-
```console
398-
docker compose build
399-
docker compose up --wait
400-
```
397+
```console
398+
docker compose build
399+
docker compose up --wait
400+
```
401401

402402
For details on how to perform profiling, see [the Blackfire.io documentation](https://blackfire.io/docs/integrations/docker#using-the-client-for-http-profiling).

0 commit comments

Comments
 (0)