Skip to content

Instantly share code, notes, and snippets.

@lolautruche
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolautruche/539079173f21b6041d59 to your computer and use it in GitHub Desktop.
Save lolautruche/539079173f21b6041d59 to your computer and use it in GitHub Desktop.
Dynamic settings injection 3/4, as of eZ 5.4 / 2014.09 - Constructor injection
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
services:
acme_test.my_service:
class: %acme_test.my_service.class%
arguments: ["$languages$", "$content.tree_root.location_id$"]
<?php
namespace Acme\TestBundle;
class MyServiceClass
{
/**
* Prioritized languages
*
* @var array
*/
private $languages;
/**
* @var int
*/
private $rootLocationId;
public function __construct( array $languages, $rootLocationId )
{
$this->languages = $languages;
$this->rootLocationId = $rootLocationId
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment