Permalink
Browse files

[docs] enhance extend docs

  • Loading branch information...
1 parent 6213e14 commit 8e0f1bd3e8c10f47c40613a8869067412d6e4d24 @igorw igorw committed Apr 1, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 README.rst
View
@@ -84,15 +84,19 @@ can use the ``extend()`` method to do just that::
return new Twig_Environment($c['twig.loader'], $c['twig.options']);
});
- $c['twig'] = $c->extend(function ($twig, $c) {
+ $c['twig'] = $c->extend('twig', function ($twig, $c) {
$twig->addExtension(new MyTwigExtension());
return $twig;
});
+The first argument is the name of the object, the second is a function that
+gets access to the object instance and the container. The return value is
+a service definition, so you need to re-assign it on the container.
+
Fetching the Object creation function
-------------------------------------
-When you access an Object, Pimple automatically calls the function that you
+When you access an object, Pimple automatically calls the function that you
defined, which creates the Object for you. If you want to get this function,
you can use the ``raw()`` method::

0 comments on commit 8e0f1bd

Please sign in to comment.