Commit bfd65cca authored by Fabien Potencier's avatar Fabien Potencier

merged branch guillemc/patch-1 (PR #659)

This PR was merged into the master branch.

Discussion
----------

Add example of JsonUserPersister being managed

Reintroducing the example used at the beginning will make things clearer, I think.

Commits
-------

96574213 Add example of JsonUserPersister being managed
parents 90b4be53 96574213
...@@ -143,6 +143,15 @@ those definitions. ...@@ -143,6 +143,15 @@ those definitions.
This also works for shared services. This also works for shared services.
Going back to our initial example, here's how we could use the container
to manage its dependencies::
$app['user.persist_path'] = '/tmp/users';
$app['user.persister'] = $app->share(function ($app) {
return new JsonUserPersister($app['user.persist_path']);
});
Protected closures Protected closures
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment