Skip to content
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

[Data Loader] Add chain loader documentation #957

Merged
merged 1 commit into from
Jun 29, 2017
Merged
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
57 changes: 57 additions & 0 deletions Resources/doc/data-loader/chain.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

.. _data-loaders-chain:

Chain Loader
============

The ``Chain`` data loader doesn't load the image binary itself; instead
it allows for loading the image binary using any number of other
configured data loaders. For example, if you configured both a
:ref:`filesystem <data-loaders-filesystem>` and
:ref:`flysystem <data-loaders-flysystem>` data loader, this loader can
be defined to load from both in a defined order, returning the image
binary from the first that responds.

.. tip::

This loader iterates over the data loaders in the order they are
configured in the chain definition, returning an image binary from
the first loader that supports the passed file path. This means if
a file exists in more than one loader, the file will be returned
using the first one defined in your configuration file for this
chain loader.



Configuration
-------------

As this loader leverages any number of other configured loaders, its
configuration is relatively simple; it supports only a ``loaders``
option that accepts an array of other configured loader names:

.. code-block:: yaml

# app/config/config.yml

liip_imagine:
loaders:
foo:
filesystem:
# configure filesystem loader

bar:
flysystem:
# configure flysystem loader

baz:
stream:
# configure stream loader

qux:
chain:
# use the "foo", "bar", and "baz" loaders
loaders:
- foo
- bar
- baz