Skip to content

Commit 18e6d9e

Browse files
Removed "Accessing the Container Directly"
Removed "Accessing the Container Directly" section, as this way of work is currently deprecated.
1 parent 89e38ef commit 18e6d9e

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

controller.rst

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -290,31 +290,6 @@ in your controllers.
290290

291291
For more information about services, see the :doc:`/service_container` article.
292292

293-
.. _controller-access-services-directly:
294-
295-
Accessing the Container Directly
296-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297-
298-
If you extend the base ``Controller`` class, you can access :ref:`public services <container-public>`
299-
via the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::get`
300-
method. Here are several common services you might need::
301-
302-
$twig = $this->get('twig');
303-
304-
$mailer = $this->get('mailer');
305-
306-
// you can also fetch parameters
307-
$someParameter = $this->getParameter('some_parameter');
308-
309-
If you receive an error like:
310-
311-
.. code-block:: text
312-
313-
You have requested a non-existent service "my_service_id"
314-
315-
Check to make sure the service exists (use :ref:`debug:container <container-debug-container>`)
316-
and that it's :ref:`public <container-public>`.
317-
318293
.. index::
319294
single: Controller; Managing errors
320295
single: Controller; 404 pages

0 commit comments

Comments
 (0)