Skip to content

[WCM] Document possibility to use ContainerAwareTrait #2891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 18, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions book/controller.rst
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,15 @@ itself.
: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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding

.. tip::

    If you're 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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in both ways, you also need to add:

.. versionadded:: 2.4
    The ``ContainerAwareTrait`` is new in Symfony 2.4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use the original change, you need to add a space before or (line 381)

.. note::

You can also define your :doc:`Controllers as Services</cookbook/controller/service>`.
Expand Down