From fcddead0b2321f1ddc7ef62c1194cb77ce44a9d8 Mon Sep 17 00:00:00 2001 From: BETARI Date: Sun, 10 Nov 2019 19:50:21 +0100 Subject: [PATCH] Update best_practices.rst --- best_practices.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/best_practices.rst b/best_practices.rst index 692761d4fda..22f978095ab 100644 --- a/best_practices.rst +++ b/best_practices.rst @@ -234,8 +234,7 @@ the fact that a controller should always return a ``Response`` object. Use Dependency Injection to Get Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you extend the base ``AbstractController``, you can't access services -directly from the container via ``$this->container->get()`` or ``$this->get()``. +If you extend the base ``AbstractController``, you can only access to the most common services (e.g ``twig``, ``router``, ``doctrine``, etc.), directly from the container via ``$this->container->get()`` or ``$this->get()``. Instead, you must use dependency injection to fetch services by :ref:`type-hinting action method arguments ` or constructor arguments.