Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ console command:

For more information, see the :doc:`/book/service_container` chapter.

.. tip::

To get a container configuration parameter in controller you can use the
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getParameter`
method::

$from = $this->getParameter('app.mailer.from');

.. index::
single: Controller; Managing errors
single: Controller; 404 pages
Expand Down
4 changes: 2 additions & 2 deletions cookbook/controller/upload_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Finally, you need to update the code of the controller that handles the form::

// Move the file to the directory where brochures are stored
$file->move(
$this->container->getParameter('brochures_directory'),
$this->getParameter('brochures_directory'),
$fileName
);

Expand Down Expand Up @@ -408,7 +408,7 @@ Now, register this class as a Doctrine listener:

// app/config/services.php
use Symfony\Component\DependencyInjection\Reference;

// ...
$definition = new Definition(
'AppBundle\EventListener\BrochureUploaderListener',
Expand Down