Last active
August 29, 2015 14:07
-
-
Save lolautruche/d40398dd60653682b535 to your computer and use it in GitHub Desktop.
Dynamic settings injection 1/4, before eZ 5.4 / 2014.09
This file contains hidden or 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: [@ezpublish.config.resolver] |
This file contains hidden or 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; | |
use eZ\Publish\Core\MVC\ConfigResolverInterface; | |
class MyServiceClass | |
{ | |
/** | |
* @var ConfigResolverInterface | |
*/ | |
private $configResolver; | |
public function __construct( ConfigResolverInterface $configResolver ) | |
{ | |
$this->configResolver = $configResolver | |
} | |
public function doSomethingWithLanguages() | |
{ | |
$languages = $this->configResolver->getParameter( 'languages' ); | |
// Do something... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment