From ba7ed522ad0be2835719fb2f445664358c672812 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sat, 6 Jan 2024 02:58:12 +0100 Subject: [PATCH] :memo: Update documentation about automatic service registering --- Resources/doc/data-loaders-custom.rst | 12 +++++++++++- Resources/doc/filters.rst | 14 ++++++++++++-- Resources/doc/post-processors.rst | 12 +++++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Resources/doc/data-loaders-custom.rst b/Resources/doc/data-loaders-custom.rst index 7aa23b26..7d83b0da 100644 --- a/Resources/doc/data-loaders-custom.rst +++ b/Resources/doc/data-loaders-custom.rst @@ -25,7 +25,17 @@ path to the image and needs to return an instance of ``BinaryInterface``. to sanitize this parameter in your loader to avoid exposing files outside of your image collections. -You need to `configure a service`_ with your custom loader and tag it with +Register it: automatically +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By default, your loader will be automatically registered as it implements the ``LoaderInterface``. + +You will be able to reference and use your custom loader in your configuration by using its Fully Qualified Class Name. + +Register it: manually +^^^^^^^^^^^^^^^^^^^^^ + +If you want to give it a different name you need to `configure a service`_ with your custom loader and tag it with ``liip_imagine.binary.loader``. To register ``App\Service\MyCustomDataLoader`` with the name diff --git a/Resources/doc/filters.rst b/Resources/doc/filters.rst index 9c41d6b2..f7d20a08 100644 --- a/Resources/doc/filters.rst +++ b/Resources/doc/filters.rst @@ -53,7 +53,17 @@ The ``LoaderInterface`` has the method ``load``, which is provided an instance of ``ImageInterface`` and an array of options. It must return an ``ImageInterface``. -You need to `configure a service`_ and tag it ``liip_imagine.filter.loader``. +Register it: automatically +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By default, your filter will be automatically registered as it implements the ``LoaderInterface``. + +You will be able to reference and use your custom filter when defining filter sets in your configuration by using its Fully Qualified Class Name. + +Register it: manually +^^^^^^^^^^^^^^^^^^^^^ + +If you want to give it a different name you need to `configure a service`_ and tag it ``liip_imagine.filter.loader``. To register a filter ``App\Service\MyCustomFilter`` as ``my_custom_filter``, use the following configuration: @@ -124,7 +134,7 @@ to the image, by passing configuration as third parameter to ``applyFilter``: public function filter(int $width, int $height) { $filter = '...'; // Name of the `filter_set` in `config/packages/liip_imagine.yaml` $path = '...'; // Path of the image, relative to `/public/` - + if (!$this->cacheManager->isStored($path, $filter)) { $binary = $this->dataManager->find($filter, $path); diff --git a/Resources/doc/post-processors.rst b/Resources/doc/post-processors.rst index 64b2e017..57fe3d47 100644 --- a/Resources/doc/post-processors.rst +++ b/Resources/doc/post-processors.rst @@ -131,7 +131,17 @@ for your custom post-processor. } } -You need to `configure a service`_ with your custom post-processor and tag it +Register it: automatically +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By default, your post-processor will be automatically registered as it implements the ``PostProcessorInterface``. + +You will be able to reference and use your custom post-processor in your configuration by using its Fully Qualified Class Name. + +Register it: manually +^^^^^^^^^^^^^^^^^^^^^ + +If you want to give it a different name you need to `configure a service`_ with your custom post-processor and tag it with ``liip_imagine.filter.post_processor``. To register ``App\Service\MyCustomPostProcessor`` with the name