Last active
August 29, 2015 14:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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$"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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