From 03aaa5c195da6003faf3135d61a5c0c87ee5ad9e Mon Sep 17 00:00:00 2001 From: Jeroen van den Enden Date: Sun, 11 Aug 2013 14:12:13 +0200 Subject: [PATCH 1/2] Document possibility to use ContainerAwareTrait In addition to https://github.com/symfony/symfony/pull/8488 --- book/controller.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index c8e01927de2..5955938a626 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -378,8 +378,11 @@ itself. Extending the base class is *optional* in Symfony; it contains useful shortcuts but nothing mandatory. You can also extend - :class:`Symfony\\Component\\DependencyInjection\\ContainerAware`. The service - container object will then be accessible via the ``container`` property. + :class:`Symfony\\Component\\DependencyInjection\\ContainerAware`or use the + :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` (>= PHP 5.4). + Both provide an implementation to the + :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, making the + service container object accessible via the ``container`` property. .. note:: From a801c09bf18ac6ee67161230aa4e7361ad63824c Mon Sep 17 00:00:00 2001 From: endroid Date: Tue, 27 Aug 2013 18:53:36 -0400 Subject: [PATCH 2/2] Improve documentation of ContentAwareTrait --- book/controller.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) mode change 100644 => 100755 book/controller.rst diff --git a/book/controller.rst b/book/controller.rst old mode 100644 new mode 100755 index 5955938a626..0c1ea72abb9 --- a/book/controller.rst +++ b/book/controller.rst @@ -378,11 +378,17 @@ itself. Extending the base class is *optional* in Symfony; it contains useful shortcuts but nothing mandatory. You can also extend - :class:`Symfony\\Component\\DependencyInjection\\ContainerAware`or use the - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` (>= PHP 5.4). - Both provide an implementation to the - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, making the - service container object accessible via the ``container`` property. + :class:`Symfony\\Component\\DependencyInjection\\ContainerAware`. The service + container object will then be accessible via the ``container`` property. + +.. tip:: + + If your host uses PHP 5.4 or higher, you can also use the + class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` trait to + make the container accessible via the ``container`` property. + +.. versionadded:: 2.4 + The ``ContainerAwareTrait`` is new in Symfony 2.4 .. note::