Skip to content

Commit ef1d95a

Browse files
authored
Merge pull request #957 from robfrawley/feature-document-chain-loader
Add chain loader documentation
2 parents 6e1be77 + 2301d94 commit ef1d95a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Resources/doc/data-loader/chain.rst

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
.. _data-loaders-chain:
3+
4+
Chain Loader
5+
============
6+
7+
The ``Chain`` data loader doesn't load the image binary itself; instead
8+
it allows for loading the image binary using any number of other
9+
configured data loaders. For example, if you configured both a
10+
:ref:`filesystem <data-loaders-filesystem>` and
11+
:ref:`flysystem <data-loaders-flysystem>` data loader, this loader can
12+
be defined to load from both in a defined order, returning the image
13+
binary from the first that responds.
14+
15+
.. tip::
16+
17+
This loader iterates over the data loaders in the order they are
18+
configured in the chain definition, returning an image binary from
19+
the first loader that supports the passed file path. This means if
20+
a file exists in more than one loader, the file will be returned
21+
using the first one defined in your configuration file for this
22+
chain loader.
23+
24+
25+
26+
Configuration
27+
-------------
28+
29+
As this loader leverages any number of other configured loaders, its
30+
configuration is relatively simple; it supports only a ``loaders``
31+
option that accepts an array of other configured loader names:
32+
33+
.. code-block:: yaml
34+
35+
# app/config/config.yml
36+
37+
liip_imagine:
38+
loaders:
39+
foo:
40+
filesystem:
41+
# configure filesystem loader
42+
43+
bar:
44+
flysystem:
45+
# configure flysystem loader
46+
47+
baz:
48+
stream:
49+
# configure stream loader
50+
51+
qux:
52+
chain:
53+
# use the "foo", "bar", and "baz" loaders
54+
loaders:
55+
- foo
56+
- bar
57+
- baz

0 commit comments

Comments
 (0)