public function Definition::setDecoratedService in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php \Symfony\Component\DependencyInjection\Definition::setDecoratedService()
Sets the service that this service is decorating.
Parameters
null|string $id The decorated service id, use null to remove decoration:
null|string $renamedId The new decorated service id:
Return value
Definition The current instance
Throws
InvalidArgumentException In case the decorated service id and the new decorated service id are equals.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Definition.php, line 154
Class
- Definition
- Definition represents a service definition.
Namespace
Symfony\Component\DependencyInjectionCode
public function setDecoratedService($id, $renamedId = null) {
if ($renamedId && $id == $renamedId) {
throw new \InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
}
if (null === $id) {
$this->decoratedService = null;
}
else {
$this->decoratedService = array(
$id,
$renamedId,
);
}
return $this;
}