Skip to content

Instantly share code, notes, and snippets.

@lolautruche
Last active August 29, 2015 14:07
Show Gist options
  • Save lolautruche/cec1adb1da355ea4bde5 to your computer and use it in GitHub Desktop.
Save lolautruche/cec1adb1da355ea4bde5 to your computer and use it in GitHub Desktop.
Dynamic settings injection 2/4, as eZ 5.4 / 2014.09 - Setter injection
parameters:
acme_test.my_service.class: Acme\TestBundle\MyServiceClass
services:
acme_test.my_service:
class: %acme_test.my_service.class%
calls:
# Will resolve ezsettings.<current_siteaccess>.languages
- [setLanguages, ["$languages$"]]
- [setRootLocationId, ["$content.tree_root.location_id$"]]
<?php
namespace Acme\TestBundle;
class MyServiceClass
{
/**
* Prioritized languages
*
* @var array
*/
private $languages;
/**
* @var int
*/
private $rootLocationId;
public function setLanguages( array $languages = null )
{
$this->languages = $languages;
}
public function setRootLocationId( $rootLocationId = null )
{
$this->rootLocationId = $rootLocationId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment