From 8a00fdbcd4f27bf399b65dacff7b06615a7ea363 Mon Sep 17 00:00:00 2001 From: jay-low <40628500+jay-low@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:24:17 +0200 Subject: [PATCH] docs: remove indentation to fix faulty code blocks (#1810) --- core/filters.md | 190 ++++++++++++++++++++++---------------------- core/pagination.md | 60 +++++++------- core/performance.md | 60 +++++++------- 3 files changed, 155 insertions(+), 155 deletions(-) diff --git a/core/filters.md b/core/filters.md index eee4767e983..1afb7454f3e 100644 --- a/core/filters.md +++ b/core/filters.md @@ -23,112 +23,112 @@ to a Resource in two ways: 1. Through the resource declaration, as the `filters` attribute. - For example, having a filter service declaration in `services.yaml`: +For example, having a filter service declaration in `services.yaml`: - ```yaml - # api/config/services.yaml - services: +```yaml +# api/config/services.yaml +services: + # ... + offer.date_filter: + parent: 'api_platform.doctrine.orm.date_filter' + arguments: [ { dateProperty: ~ } ] + tags: [ 'api_platform.filter' ] + # The following are mandatory only if a _defaults section is defined with inverted values. + # You may want to isolate filters in a dedicated file to avoid adding the following lines. + autowire: false + autoconfigure: false + public: false +``` + +Alternatively, you can choose to use a dedicated file to gather filters together: + +```yaml +# api/config/filters.yaml +services: + offer.date_filter: + parent: 'api_platform.doctrine.orm.date_filter' + arguments: [ { dateProperty: ~ } ] + tags: [ 'api_platform.filter' ] +``` + +We're linking the filter `offer.date_filter` with the resource like this: + +[codeSelector] + +```php + - - - - - - - - offer.date_filter - - - - - - - ``` - - [/codeSelector] +``` + +```xml + + + + + + + + + offer.date_filter + + + + + + +``` + +[/codeSelector] 2. By using the `#[ApiFilter]` attribute. - This attribute automatically declares the service, and you just have to use the filter class you want: +This attribute automatically declares the service, and you just have to use the filter class you want: - ```php - $PHP_INI_DIR/conf.d/blackfire.ini - ``` +```dockerfile + RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini +``` 4. Rebuild and restart all your containers - ```console - docker compose build - docker compose up --wait - ``` +```console +docker compose build +docker compose up --wait +``` For details on how to perform profiling, see [the Blackfire.io documentation](https://blackfire.io/docs/integrations/docker#using-the-client-for-http-profiling).