Skip to content

Commit fbaeccf

Browse files
Jonczykxabbuh
Jonczyk
authored andcommitted
improve service container parameters section
1 parent 9787e64 commit fbaeccf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

service_container.rst

+14
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,20 @@ Actually, once you define a parameter, it can be referenced via the ``%parameter
402402
syntax in *any* other service configuration file - like ``config.yml``. Many parameters
403403
are defined in a :ref:`parameters.yml file <config-parameters-yml>`.
404404

405+
You can then fetch the parameter in the service::
406+
407+
class SiteUpdateManager
408+
{
409+
// ...
410+
411+
private $adminEmail;
412+
413+
public function __construct($adminEmail)
414+
{
415+
$this->adminEmail = $adminEmail;
416+
}
417+
}
418+
405419
You can also fetch parameters directly from the container::
406420

407421
public function newAction()

0 commit comments

Comments
 (0)