Last active
August 29, 2015 14:07
-
-
Save lolautruche/2f5aeca15332bcd5220b to your computer and use it in GitHub Desktop.
Dynamic settings injection 4/4, as of eZ 5.4 / 2014.09 - 3rd party parameters
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 | |
# "acme" is our parameter namespace. | |
# Null is the default value. | |
acme.default.some_parameter: ~ | |
acme.ezdemo_site.some_parameter: foo | |
acme.ezdemo_site_admin.some_parameter: bar | |
services: | |
acme_test.my_service: | |
class: %acme_test.my_service.class% | |
# The following argument will automatically resolve to the right value, depending on the current SiteAccess. | |
# We specify "acme" as the namespace we want to use for parameter resolving. | |
calls: | |
- [setSomeParameter, ["$some_parameter;acme$"]] |
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; | |
class MyServiceClass | |
{ | |
private $myParameter; | |
public function setSomeParameter( $myParameter = null ) | |
{ | |
// Will be "foo" for ezdemo_site, "bar" for ezdemo_site_admin, or null if another SiteAccess. | |
$this->myParameter = $myParameter; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment