function Definition::addMethodCall
Adds a method to call after service initialization.
Parameters
string $method The method name to call:
array $arguments An array of arguments to pass to the method call:
bool $returnsClone Whether the call returns the service instance or not:
Return value
$this
Throws
InvalidArgumentException on empty $method param
1 call to Definition::addMethodCall()
- Definition::setMethodCalls in vendor/
symfony/ dependency-injection/ Definition.php - Sets the methods to call after service initialization.
File
-
vendor/
symfony/ dependency-injection/ Definition.php, line 327
Class
- Definition
- Definition represents a service definition.
Namespace
Symfony\Component\DependencyInjectionCode
public function addMethodCall(string $method, array $arguments = [], bool $returnsClone = false) : static {
if (!$method) {
throw new InvalidArgumentException('Method name cannot be empty.');
}
$this->calls[] = $returnsClone ? [
$method,
$arguments,
true,
] : [
$method,
$arguments,
];
return $this;
}