zendframework/zf2 — pull request #2718 by roelvanduijnhoven (2012-10-09 20:16:06+00:00)
Title: Chain authentication storage

This component can be usefull if you want to store the identity in multiple places. For example once in the database and once in `$_SESSION`. If either one of the storages is non-empty then the chain should also be non-empty.

On top of that the order in which the storages are accessed is important. A use case that is often used: the identity is stored in the database and can be obtained using a cookie on the client. However one wants to retrieve this data from the database only on the first request of a browser session and therefore the identity is stored in `$_SESSION`.

Such configuration might look like:
```php
$chain = new ChainStorage;
$chain->add(new SessionStorage, 2);
$chain->add(new DatabaseStorage, 1);
```

I developed the component for a website I am developing, but though it might be of use to other people.